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

Message::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 5
crap 1
1
<?php
2
3
namespace Tgallice\FBMessenger\Model\Callback;
4
5
class Message
6
{
7
    /**
8
     * @var string
9
     */
10
    private $id;
11
12
    /**
13
     * @var int
14
     */
15
    private $sequence;
16
17
    /**
18
     * @var null|string
19
     */
20
    private $text;
21
22
    /**
23
     * @var array
24
     */
25
    private $attachments;
26
27
    /**
28
     * @var null|string
29
     */
30
    private $quickReply;
31
32
    /**
33
     * @param string $id
34
     * @param int $sequence
35
     * @param null|string $text
36
     * @param array $attachments
37
     * @param null|string $quickReply
38
     */
39 19
    public function __construct($id, $sequence, $text = null, array $attachments = [], $quickReply = null)
40
    {
41 19
        $this->id = $id;
42 19
        $this->sequence = $sequence;
43 19
        $this->text = $text;
44 19
        $this->attachments = $attachments;
45 19
        $this->quickReply = $quickReply;
46 19
    }
47
48
    /**
49
     * @return string
50
     */
51 1
    public function getId()
52
    {
53 1
        return $this->id;
54
    }
55
56
    /**
57
     * @return int
58
     */
59 1
    public function getSequence()
60
    {
61 1
        return $this->sequence;
62
    }
63
64
    /**
65
     * @return null|string
66
     */
67 2
    public function getText()
68
    {
69 2
        return $this->text;
70
    }
71
72
    /**
73
     * @return array
74
     */
75 2
    public function getAttachments()
76
    {
77 2
        return $this->attachments;
78
    }
79
80
    /**
81
     * @return null|string
82
     */
83 2
    public function getQuickReply()
84
    {
85 2
        return $this->quickReply;
86
    }
87
88
    /**
89
     * @return bool
90
     */
91 1
    public function hasText()
92
    {
93 1
        return !empty($this->text);
94
    }
95
96
    /**
97
     * @return bool
98
     */
99 1
    public function hasAttachments()
100
    {
101 1
        return !empty($this->attachments);
102
    }
103
104
    /**
105
     * @return bool
106
     */
107 1
    public function hasQuickReply()
108
    {
109 1
        return !empty($this->quickReply);
110
    }
111
112
    /**
113
     * @param array $payload
114
     *
115
     * @return static
116
     */
117 3 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...
118
    {
119 3
        $text = isset($payload['text']) ? $payload['text'] : null;
120 3
        $attachments = isset($payload['$attachments']) ? $payload['$attachments'] : [];
121 3
        $quickReply = isset($payload['quick_reply']) ? $payload['quick_reply']['payload'] : null;
122
123 3
        return new static($payload['mid'], $payload['seq'], $text, $attachments, $quickReply);
124
    }
125
}
126