AuthorizationServer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 40 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Alexandre
5
 * Date: 12/03/2018
6
 * Time: 21:26
7
 */
8
9
namespace OAuth2\Extensions\OpenID\Roles\AuthorizationServer;
10
11
12
use OAuth2\Extensions\OpenID\Config;
13
use OAuth2\Extensions\OpenID\Endpoints\AuthorizationEndpoint;
14
use OAuth2\Extensions\OpenID\AuthorizationGrantTypes\Flows\AuthorizationCodeFlow;
15
use OAuth2\Extensions\OpenID\AuthorizationGrantTypes\Flows\HybridFlow;
16
use OAuth2\Extensions\OpenID\AuthorizationGrantTypes\Flows\ImplicitFlow;
17
use OAuth2\Extensions\OpenID\IdTokenManager;
18
use OAuth2\Extensions\OpenID\Storages\StorageManager;
19
use OAuth2\ScopePolicy\ScopePolicyManager;
20
21
class AuthorizationServer extends \OAuth2\Roles\AuthorizationServer\AuthorizationServer
22
{
23
    protected $idTokenManager;
24
25
    public function __construct(Config $config,
26
                                StorageManager $storageManager,
27
                                ScopePolicyManager $scopePolicyManager,
28
                                EndUserInterface $authorizationServerEndUser)
29
    {
30
        parent::__construct($config, $storageManager, $scopePolicyManager, $authorizationServerEndUser);
0 ignored issues
show
Bug introduced by
$scopePolicyManager of type OAuth2\ScopePolicy\ScopePolicyManager is incompatible with the type OAuth2\Endpoints\TokenRevocationEndpoint expected by parameter $tokenRevocationEndpoint of OAuth2\Roles\Authorizati...onServer::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

30
        parent::__construct($config, $storageManager, /** @scrutinizer ignore-type */ $scopePolicyManager, $authorizationServerEndUser);
Loading history...
Bug introduced by
$storageManager of type OAuth2\Extensions\OpenID\Storages\StorageManager is incompatible with the type OAuth2\Endpoints\TokenEndpoint expected by parameter $tokenEndpoint of OAuth2\Roles\Authorizati...onServer::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

30
        parent::__construct($config, /** @scrutinizer ignore-type */ $storageManager, $scopePolicyManager, $authorizationServerEndUser);
Loading history...
Bug introduced by
$config of type OAuth2\Extensions\OpenID\Config is incompatible with the type OAuth2\Endpoints\AuthorizationEndpoint expected by parameter $authorizationEndpoint of OAuth2\Roles\Authorizati...onServer::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

30
        parent::__construct(/** @scrutinizer ignore-type */ $config, $storageManager, $scopePolicyManager, $authorizationServerEndUser);
Loading history...
Unused Code introduced by
The call to OAuth2\Roles\Authorizati...onServer::__construct() has too many arguments starting with $authorizationServerEndUser. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
        parent::/** @scrutinizer ignore-call */ 
31
                __construct($config, $storageManager, $scopePolicyManager, $authorizationServerEndUser);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
31
32
        $this->idTokenManager = new IdTokenManager($config);
33
34
        $this->flowManager->addFlow(new AuthorizationCodeFlow(
0 ignored issues
show
Bug Best Practice introduced by
The property flowManager does not exist on OAuth2\Extensions\OpenID...ver\AuthorizationServer. Did you maybe forget to declare it?
Loading history...
35
            $storageManager->getAuthorizationCodeStorage(),
36
            $storageManager->getAccessTokenStorage(),
37
            $storageManager->getRefreshTokenStorage(),
38
            $storageManager->getClientStorage(),
39
            $storageManager->getResourceOwnerStorage(),
40
            $this->idTokenManager
41
        ));
42
43
        $this->flowManager->addFlow(new ImplicitFlow(
44
            $storageManager->getAccessTokenStorage(),
45
            $storageManager->getRefreshTokenStorage(),
46
            $this->idTokenManager
47
        ));
48
49
        $this->flowManager->addFlow(new HybridFlow(
50
            $storageManager->getAuthorizationCodeStorage(),
51
            $storageManager->getAccessTokenStorage(),
52
            $storageManager->getRefreshTokenStorage(),
53
            $this->idTokenManager
54
        ));
55
56
        $authorizationRequestBuilder = new AuthorizationRequest(
0 ignored issues
show
Bug introduced by
The type OAuth2\Extensions\OpenID...er\AuthorizationRequest 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...
57
            $storageManager->getClientStorage(),
58
            $this->responseTypeManager,
0 ignored issues
show
Bug Best Practice introduced by
The property responseTypeManager does not exist on OAuth2\Extensions\OpenID...ver\AuthorizationServer. Did you maybe forget to declare it?
Loading history...
59
            $this->responseModeManager,
0 ignored issues
show
Bug Best Practice introduced by
The property responseModeManager does not exist on OAuth2\Extensions\OpenID...ver\AuthorizationServer. Did you maybe forget to declare it?
Loading history...
60
            $this->scopePolicyManager
0 ignored issues
show
Bug Best Practice introduced by
The property scopePolicyManager does not exist on OAuth2\Extensions\OpenID...ver\AuthorizationServer. Did you maybe forget to declare it?
Loading history...
61
        );
62
        $this->authorizationEndpoint = new AuthorizationEndpoint(
63
            $authorizationRequestBuilder,
64
            $authorizationServerEndUser
65
        );
66
    }
67
}