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 ( 515224...041874 )
by Cees-Jan
04:19
created

Event   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 62
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromMessage() 0 8 2
A __construct() 0 6 1
A getEvent() 0 4 1
A getChannel() 0 4 1
A getData() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Pusher;
4
5
final class Event
6
{
7
    /**
8
     * @var string
9
     */
10
    private $event;
11
12
    /**
13
     * @var string
14
     */
15
    private $channel;
16
17
    /**
18
     * @var array
19
     */
20
    private $data;
21
22 3
    public static function createFromMessage(array $message): self
23
    {
24 3
        return new self(
25 3
            $message['event'],
26 3
            json_decode($message['data'], true),
27 3
            isset($message['channel']) ? $message['channel'] : ''
28
        );
29
    }
30
31
    /**
32
     * @param string $event
33
     * @param array $data
34
     * @param string $channel
35
     */
36 3
    public function __construct(string $event, array $data, string $channel = '')
37
    {
38 3
        $this->event = $event;
39 3
        $this->data = $data;
40 3
        $this->channel = $channel;
41 3
    }
42
43
    /**
44
     * @return string
45
     */
46 3
    public function getEvent()
47
    {
48 3
        return $this->event;
49
    }
50
51
    /**
52
     * @return string
53
     */
54 3
    public function getChannel()
55
    {
56 3
        return $this->channel;
57
    }
58
59
    /**
60
     * @return array
61
     */
62 3
    public function getData()
63
    {
64 3
        return $this->data;
65
    }
66
}
67