1 | <?php |
||
2 | /** |
||
3 | * Created by PhpStorm. |
||
4 | * User: Alexandre |
||
5 | * Date: 18/02/2018 |
||
6 | * Time: 17:51 |
||
7 | */ |
||
8 | |||
9 | namespace OAuth2; |
||
10 | |||
11 | |||
12 | use Firebase\JWT\JWT; |
||
0 ignored issues
–
show
|
|||
13 | |||
14 | class IdToken implements IdTokenInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $claims; |
||
20 | |||
21 | /** |
||
22 | * IdToken constructor. |
||
23 | * @param array $claims |
||
24 | * @throws \Exception |
||
25 | */ |
||
26 | public function __construct(array $claims) |
||
27 | { |
||
28 | // $missingClaims = array_diff(self::REQUIRED_CLAIMS, array_keys($claims)); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
57% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
29 | // if (!empty($missingClaims)) { |
||
30 | // throw new \Exception('Missing claims : ' . implode(', ', $missingClaims)); |
||
31 | // } |
||
32 | |||
33 | // $undefinedClaims = array_diff(array_keys($claims), self::DEFINED_CLAIMS); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
57% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
34 | // if (!empty($undefinedClaims)) { |
||
35 | // throw new \Exception('Undefined claims : ' . implode(', ', $undefinedClaims)); |
||
36 | // } |
||
37 | |||
38 | // todo check nonce required if present in authentication request |
||
39 | // todo check auth_time if max_age request is made or auth_time is required via config |
||
40 | |||
41 | $this->claims = $claims; |
||
42 | } |
||
43 | |||
44 | public function getClaims() : array |
||
45 | { |
||
46 | return $this->claims; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Specify data which should be serialized to JSON |
||
51 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
52 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
53 | * which is a value of any type other than a resource. |
||
54 | * @since 5.4.0 |
||
55 | */ |
||
56 | public function jsonSerialize() |
||
57 | { |
||
58 | return JWT::encode($this->getClaims(), 'key'); |
||
59 | } |
||
60 | } |
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