GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Header   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 65
c 0
b 0
f 0
wmc 9
lcom 1
cbo 3
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setParameter() 0 16 3
A findParameterByName() 0 11 3
A getParameters() 0 4 1
A jsonSerialize() 0 4 1
1
<?php
2
3
namespace Emarref\Jwt\Token;
4
5
use Emarref\Jwt\HeaderParameter;
6
use Emarref\Jwt\Claim;
7
8
class Header implements \JsonSerializable
9
{
10
    /**
11
     * @var PropertyList
12
     */
13
    protected $propertyList;
14
15
    public function __construct()
16
    {
17
        $this->propertyList = new PropertyList();
18
    }
19
20
    /**
21
     * @param HeaderParameter\ParameterInterface $parameter
22
     * @param boolean                            $critical
23
     */
24
    public function setParameter(HeaderParameter\ParameterInterface $parameter, $critical = false)
25
    {
26
        $this->propertyList->setProperty($parameter);
27
28
        if ($critical) {
29
            /** @var HeaderParameter\Critical $criticalParameter */
30
            $criticalParameter = $this->findParameterByName(HeaderParameter\Critical::NAME);
31
32
            if (!$criticalParameter) {
33
                $criticalParameter = new HeaderParameter\Critical();
34
            }
35
36
            $criticalParameter->addParameter($parameter);
37
            $this->propertyList->setProperty($criticalParameter);
38
        }
39
    }
40
41
    /**
42
     * @param string $name
43
     * @return HeaderParameter\ParameterInterface|null
44
     */
45
    public function findParameterByName($name)
46
    {
47
        foreach ($this->propertyList as $parameter) {
48
            /** @var HeaderParameter\ParameterInterface $parameter */
49
            if ($parameter->getName() === $name) {
50
                return $parameter;
51
            }
52
        }
53
54
        return null;
55
    }
56
57
    /**
58
     * @return PropertyList
59
     */
60
    public function getParameters()
61
    {
62
        return $this->propertyList;
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function jsonSerialize()
69
    {
70
        return $this->propertyList->jsonSerialize();
71
    }
72
}
73