| Total Complexity | 5 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class AuthorizationCodeFlow implements FlowInterface |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var AuthorizationCodeStorageInterface |
||
| 19 | */ |
||
| 20 | private $authorizationCodeStorage; |
||
| 21 | |||
| 22 | public function __construct(AuthorizationCodeStorageInterface $authorizationCodeStorage) |
||
| 23 | { |
||
| 24 | $this->authorizationCodeStorage = $authorizationCodeStorage; |
||
| 25 | } |
||
| 26 | |||
| 27 | function getResponseTypes(): array |
||
|
|
|||
| 28 | { |
||
| 29 | return ['code']; |
||
| 30 | } |
||
| 31 | |||
| 32 | function handleAuthorizationRequest(AuthorizationEndpoint $authorizationEndpoint, array $requestData): array |
||
| 33 | { |
||
| 34 | $authorizationCode = $this->authorizationCodeStorage->generate( |
||
| 35 | implode(' ', $authorizationEndpoint->getScopes()), |
||
| 36 | $authorizationEndpoint->getClient()->getIdentifier(), |
||
| 37 | $authorizationEndpoint->getResourceOwner()->getIdentifier(), |
||
| 38 | $requestData['scope'] ?? null, |
||
| 39 | $requestData['redirect_uri'] ?? null |
||
| 40 | ); |
||
| 41 | return ['code' => $authorizationCode->getCode()]; |
||
| 42 | } |
||
| 43 | |||
| 44 | function getDefaultResponseMode(): string |
||
| 45 | { |
||
| 46 | return 'query'; |
||
| 47 | } |
||
| 48 | |||
| 49 | function getUnsupportedResponseModes(): array |
||
| 52 | } |
||
| 53 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.