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.

PayloadBuilder::getValue()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Gandung\JWT\Token;
4
5
/**
6
 * @author Paulus Gandung Prakosa <[email protected]>
7
 */
8
class PayloadBuilder implements PayloadBuilderInterface
9
{
10
    /**
11
     * @var array
12
     */
13
    private $payload = [];
14
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function claim(ClaimBuilderInterface $claim)
19
    {
20
        return $this->collectPayload('claim', $claim->getValue());
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function userData($data = [])
27
    {
28
        return $this->collectPayload('user-data', $data);
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function getValue()
35
    {
36
        $merged = [];
37
38
        foreach ($this->payload as $value) {
39
            $merged = \array_merge_recursive($merged, $value);
40
        }
41
42
        return $merged;
43
    }
44
45
    /**
46
     * Aggregate JWT payload by pairing it's name with it's value.
47
     *
48
     * @param string $name
49
     * @param mixed $value
50
     * @return $this
51
     */
52
    private function collectPayload($name, $value)
53
    {
54
        $this->payload[$name] = $value;
55
56
        return $this;
57
    }
58
}
59