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

MessageEcho::create()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 4

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 5
cts 5
cp 1
rs 9.2
c 0
b 0
f 0
cc 4
eloc 5
nc 8
nop 1
crap 4
1
<?php
2
3
namespace Tgallice\FBMessenger\Model\Callback;
4
5
class MessageEcho extends Message
6
{
7
    /**
8
     * @var bool
9
     */
10
    private $isEcho;
11
12
    /**
13
     * @var int
14
     */
15
    private $appId;
16
17
    /**
18
     * @var null|string
19
     */
20
    private $metadata;
21
22
    /**
23
     * MessageEcho constructor.
24
     *
25
     * @param bool $isEcho
26
     * @param int $appId
27
     * @param string $id
28
     * @param int $sequence
29
     * @param null|string $metadata
30
     * @param null|string $text
31
     * @param array $attachments
32
     */
33 7
    public function __construct($isEcho, $appId, $id, $sequence, $metadata = null, $text = null, array $attachments = [])
34
    {
35 7
        parent::__construct($id, $sequence, $text, $attachments);
36 7
        $this->isEcho = $isEcho;
37 7
        $this->appId = $appId;
38 7
        $this->metadata = $metadata;
39 7
    }
40
41
    /**
42
     * @return boolean
43
     */
44 1
    public function isEcho()
45
    {
46 1
        return $this->isEcho;
47
    }
48
49
    /**
50
     * @return int
51
     */
52 1
    public function getAppId()
53
    {
54 1
        return $this->appId;
55
    }
56
57
    /**
58
     * @return null|string
59
     */
60 2
    public function getMetadata()
61
    {
62 2
        return $this->metadata;
63
    }
64
65
    /**
66
     * @param array $payload
67
     *
68
     * @return static
69
     */
70 1 View Code Duplication
    public static function create(array $payload)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
71
    {
72 1
        $metadata = isset($payload['metadata']) ? $payload['metadata'] : null;
73 1
        $text = isset($payload['text']) ? $payload['text'] : null;
74 1
        $attachments = isset($payload['attachments']) ? $payload['attachments'] : [];
75
76 1
        return new static(true, $payload['app_id'], $payload['mid'], $payload['seq'], $metadata, $text, $attachments);
77
    }
78
}
79