Passed
Push — master ( 9b369b...9fe481 )
by Dāvis
04:59
created

VariableTrait::setStatusCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Sludio\HelperBundle\Openidconnect\Provider;
4
5
use Sludio\HelperBundle\Openidconnect\Specification;
6
use Symfony\Component\HttpFoundation\Session\Session;
7
use Lcobucci\JWT\Signer;
0 ignored issues
show
Bug introduced by
The type Lcobucci\JWT\Signer 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...
8
use Symfony\Bundle\FrameworkBundle\Routing\Router;
9
use Psr\Http\Message\ResponseInterface;
0 ignored issues
show
Bug introduced by
The type Psr\Http\Message\ResponseInterface 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...
10
use League\OAuth2\Client\Token\AccessToken as BaseAccessToken;
0 ignored issues
show
Bug introduced by
The type League\OAuth2\Client\Token\AccessToken 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...
11
12
trait VariableTrait
13
{
14
    /**
15
     * @var string
16
     */
17
    protected $publicKey;
18
19
    /**
20
     * @var Signer
21
     */
22
    protected $signer;
23
24
    /**
25
     * @var Specification\ValidatorChain
26
     */
27
    protected $validatorChain;
28
29
    /**
30
     * @var string
31
     */
32
    protected $idTokenIssuer;
33
    /**
34
     * @var Uri[]
35
     */
36
    protected $uris = [];
37
38
    /**
39
     * @var bool
40
     */
41
    protected $useSession;
42
43
    /**
44
     * @var Session
45
     */
46
    protected $session;
47
48
    /**
49
     * @var int
50
     */
51
    protected $statusCode;
52
53
    /**
54
     * @var Router
55
     */
56
    protected $router;
57
58
    /**
59
     * @var string
60
     */
61
    private $baseUri;
62
63
    protected function checkResponse(ResponseInterface $response, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $response is not used and could be removed. ( Ignorable by Annotation )

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

63
    protected function checkResponse(/** @scrutinizer ignore-unused */ ResponseInterface $response, $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

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

63
    protected function checkResponse(ResponseInterface $response, /** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
64
    {
65
    }
66
67
    public function check($response = null)
0 ignored issues
show
Unused Code introduced by
The parameter $response is not used and could be removed. ( Ignorable by Annotation )

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

67
    public function check(/** @scrutinizer ignore-unused */ $response = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
68
    {
69
        return true;
70
    }
71
72
    /**
73
     * Get the issuer of the OpenID Connect id_token
74
     *
75
     * @return string
76
     */
77
    protected function getIdTokenIssuer()
78
    {
79
        return $this->idTokenIssuer;
80
    }
81
82
    public function getBaseAuthorizationUrl()
83
    {
84
        return '';
85
    }
86
87
    public function getBaseAccessTokenUrl(array $params)
0 ignored issues
show
Unused Code introduced by
The parameter $params is not used and could be removed. ( Ignorable by Annotation )

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

87
    public function getBaseAccessTokenUrl(/** @scrutinizer ignore-unused */ array $params)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
88
    {
89
        return '';
90
    }
91
92
    public function getDefaultScopes()
93
    {
94
        return [];
95
    }
96
97
    public function getResourceOwnerDetailsUrl(BaseAccessToken $token)
0 ignored issues
show
Unused Code introduced by
The parameter $token is not used and could be removed. ( Ignorable by Annotation )

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

97
    public function getResourceOwnerDetailsUrl(/** @scrutinizer ignore-unused */ BaseAccessToken $token)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
98
    {
99
    }
100
101
    /**
102
     * Overload parent as OpenID Connect specification states scopes shall be separated by spaces
103
     *
104
     * @return string
105
     */
106
    protected function getScopeSeparator()
107
    {
108
        return ' ';
109
    }
110
111
    protected function createResourceOwner(array $response, BaseAccessToken $token)
0 ignored issues
show
Unused Code introduced by
The parameter $response is not used and could be removed. ( Ignorable by Annotation )

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

111
    protected function createResourceOwner(/** @scrutinizer ignore-unused */ array $response, BaseAccessToken $token)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $token is not used and could be removed. ( Ignorable by Annotation )

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

111
    protected function createResourceOwner(array $response, /** @scrutinizer ignore-unused */ BaseAccessToken $token)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
112
    {
113
        return [];
114
    }
115
116
    /**
117
     * @return Specification\ValidatorChain
118
     */
119
    public function getValidatorChain()
120
    {
121
        return $this->validatorChain;
122
    }
123
124
    public function getUri($name)
125
    {
126
        return $this->uris[$name];
127
    }
128
    /**
129
     * @return mixed
130
     */
131
    public function getStatusCode()
132
    {
133
        return $this->statusCode;
134
    }
135
136
    /**
137
     * @param mixed $statusCode
138
     *
139
     * @return $this
140
     */
141
    public function setStatusCode($statusCode)
142
    {
143
        $this->statusCode = $statusCode;
144
145
        return $this;
146
    }
147
148
    /**
149
     * Returns all options that are required.
150
     *
151
     * @return array
152
     */
153
    protected function getRequiredOptions()
154
    {
155
        return [];
156
    }
157
158
    abstract public function getValidateTokenUrl();
159
160
    abstract public function getRefreshTokenUrl();
161
162
    abstract public function getRevokeTokenUrl();
163
164
}
165