Passed
Pull Request — master (#13)
by Steve
01:48
created

ScopeRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getScopeEntityByIdentifier() 0 23 2
1
<?php
2
/**
3
 * @author      Alex Bilbie <[email protected]>
4
 * @copyright   Copyright (c) Alex Bilbie
5
 * @license     http://mit-license.org/
6
 *
7
 * @link        https://github.com/thephpleague/oauth2-server
8
 */
9
10
namespace OpenIDConnectServerExamples\Repositories;
11
12
use League\OAuth2\Server\Entities\ClientEntityInterface;
13
use League\OAuth2\Server\Repositories\ScopeRepositoryInterface;
14
use OAuth2ServerExamples\Entities\ScopeEntity;
0 ignored issues
show
Bug introduced by
The type OAuth2ServerExamples\Entities\ScopeEntity was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
16
class ScopeRepository extends \OAuth2ServerExamples\Repositories\ScopeRepository
0 ignored issues
show
Bug introduced by
The type OAuth2ServerExamples\Repositories\ScopeRepository was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function getScopeEntityByIdentifier($scopeIdentifier)
22
    {
23
        $scopes = [
24
            // Without this OpenID Connect cannot work.
25
            'openid' => [
26
                'description' => 'Enable OpenID Connect support'
27
            ],
28
            'basic' => [
29
                'description' => 'Basic details about you',
30
            ],
31
            'email' => [
32
                'description' => 'Your email address',
33
            ],
34
        ];
35
36
        if (array_key_exists($scopeIdentifier, $scopes) === false) {
37
            return;
38
        }
39
40
        $scope = new ScopeEntity();
41
        $scope->setIdentifier($scopeIdentifier);
42
43
        return $scope;
44
    }
45
}
46