| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function respondToAccessTokenRequest( |
||
| 20 | ServerRequestInterface $request, |
||
| 21 | ResponseTypeInterface $responseType, |
||
| 22 | DateInterval $accessTokenTTL |
||
| 23 | ) { |
||
| 24 | // Validate request |
||
| 25 | $client = $this->validateClient($request); |
||
| 26 | $scopes = $this->validateScopes($this->getRequestParameter('scope', $request)); |
||
| 27 | |||
| 28 | // Finalize the requested scopes |
||
| 29 | $scopes = $this->scopeRepository->finalizeScopes($scopes, $this->getIdentifier(), $client); |
||
| 30 | |||
| 31 | // Issue and persist access token |
||
| 32 | $accessToken = $this->issueAccessToken( |
||
| 33 | $accessTokenTTL, |
||
| 34 | $client, |
||
| 35 | $this->getRequestParameter('user_id', $request), |
||
| 36 | $scopes |
||
| 37 | ); |
||
| 38 | // Inject access token into response type |
||
| 39 | $responseType->setAccessToken($accessToken); |
||
|
|
|||
| 40 | return $responseType; |
||
| 41 | } |
||
| 42 | |||
| 51 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: