| Conditions | 4 |
| Paths | 5 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function check(OAuth2Token $token, OAuth2 $configuration): void |
||
| 22 | { |
||
| 23 | $scope = $configuration->getScope(); |
||
| 24 | if (null === $scope) { |
||
| 25 | return; |
||
| 26 | } |
||
| 27 | |||
| 28 | $scopes = explode(' ', $scope); |
||
| 29 | $tokenScope = $token->getAccessToken()->getParameter()->has('scope') ? explode(' ', $token->getAccessToken()->getParameter()->get('scope')) : []; |
||
| 30 | $diff = array_diff($scopes, $tokenScope); |
||
| 31 | |||
| 32 | if (0 !== \count($diff)) { |
||
| 33 | throw new \Exception(\Safe\sprintf('Insufficient scope. The required scope is "%s"', $configuration->getScope())); |
||
| 34 | } |
||
| 37 |