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.
Completed
Push — master ( 912221...961991 )
by Gallice
05:44 queued 02:40
created

RawEvent::get()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3

Importance

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