<?php
 namespace League\OAuth2\Client\Grant; use League\OAuth2\Client\Tool\RequiredParameterTrait; abstract class AbstractGrant { use RequiredParameterTrait; abstract protected function getName(); abstract protected function getRequiredRequestParameters(); public function __toString() { return $this->getName(); } public function prepareRequestParameters(array $defaults, array $options) { $defaults['grant_type'] = $this->getName(); $required = $this->getRequiredRequestParameters(); $provided = array_merge($defaults, $options); $this->checkRequiredParameters($required, $provided); return $provided; } } 