| Total Complexity | 8 |
| Total Lines | 77 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | trait OauthContext |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Name of the oauth client id in the graphql context. |
||
| 11 | * |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | protected static $oauthClientKey = 'oauthClientIdentifier'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Name of the oauth scopes in the graphql context. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected static $oauthScopesKey = 'oauthScopes'; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Determine if the scope has a valid client. |
||
| 25 | * |
||
| 26 | * @param array $context |
||
| 27 | * |
||
| 28 | * @return bool |
||
| 29 | */ |
||
| 30 | public function hasOauthClient(array $context) |
||
| 31 | { |
||
| 32 | return !empty($context[self::$oauthClientKey]); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Return the model for the Oauth Client. |
||
| 37 | * |
||
| 38 | * @param array $context |
||
| 39 | * |
||
| 40 | * @return null|\SilverStripe\ORM\DataObject |
||
| 41 | */ |
||
| 42 | public function getOauthClient(array $context) |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Determine whether the a scope has been granted. |
||
| 53 | * |
||
| 54 | * @param array $context |
||
| 55 | * @param string $scope |
||
| 56 | * |
||
| 57 | * @return bool |
||
| 58 | */ |
||
| 59 | public function hasScope(array $context, string $scope) |
||
| 60 | { |
||
| 61 | return !empty($context[self::$oauthScopesKey]) && in_array($scope, $context[self::$oauthScopesKey]); |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Determnie whether all the scopes have been granted. |
||
| 66 | * |
||
| 67 | * @param array $context |
||
| 68 | * @param array $scopes |
||
| 69 | * |
||
| 70 | * @return bool |
||
| 71 | */ |
||
| 72 | public function hasScopes(array $context, array $scopes) |
||
| 84 | } |
||
| 85 | } |
||
| 86 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths