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.

RawEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
crap 1
1
<?php
2
3
namespace Tgallice\FBMessenger\Callback;
4
5
class RawEvent extends CallbackEvent
6
{
7
    const NAME = 'raw_event';
8
9
    /**
10
     * @var array
11
     */
12
    private $raw;
13
14 10
    public function __construct($senderId, $recipientId, array $raw)
15
    {
16 10
        parent::__construct($senderId, $recipientId);
17 10
        $this->raw = $raw;
18 10
    }
19
20
    /**
21
     * @return array
22
     */
23 1
    public function getRaw()
24
    {
25 1
        return $this->raw;
26
    }
27
28
    /**
29
     * @param string $index
30
     * @param null|mixed $default
31
     *
32
     * @return mixed
33
     */
34 3
    public function get($index, $default = null)
35
    {
36 3
        $indexes = explode('.', trim($index, '.'));
37 3
        $payload = $this->raw;
38 3
        $value = $default;
39
40 3
        foreach ($indexes as $indexValue) {
41 3
            if (!isset($payload[$indexValue])) {
42 1
                return $default;
43
            }
44 2
            $value = $payload = $payload[$indexValue];
45 2
        }
46
47 2
        return $value;
48
    }
49
50
    /**
51
     * @return string
52
     */
53 1
    public function getName()
54
    {
55 1
        return self::NAME;
56
    }
57
}
58