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 ( 4580b2...aafc3c )
by Dwight
17:23 queued 16:18
created

ApnMessage::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 4
crap 1
1
<?php
2
3
namespace NotificationChannels\Apn;
4
5
class ApnMessage
6
{
7
    /**
8
     * The title of the notification.
9
     *
10
     * @var string
11
     */
12
    public $title;
13
14
    /**
15
     * The body of the notification.
16
     *
17
     * @var string
18
     */
19
    public $body;
20
21
    /**
22
     * The badge of the notification.
23
     *
24
     * @var int
25
     */
26
    public $badge;
27
28
    /**
29
     * The sound for the notification.
30
     *
31
     * @var string|null
32
     */
33
    public $sound;
34
35
    /**
36
     * The category for action button.
37
     *
38
     * @var string|null
39
     * */
40
    public $category;
41
42
    /**
43
     * Value indicating incoming resource in the notification.
44
     *
45
     * @var int|null
46
     */
47
    public $contentAvailable = null;
48
49
    /**
50
     * Additional data of the notification.
51
     *
52
     * @var array
53
     */
54
    public $custom = [];
55
56
    /**
57
     * Value indicating when the message will expire.
58
     *
59
     * @var \string
60
     */
61
    public $pushType = null;
62
63
    /**
64
     * Message specific credentials.
65
     *
66
     * @var ApnCredentials
67
     */
68
    public $credentials = null;
69
70
    /**
71
     * The notification service app extension flag.
72
     *
73
     * @var int|null
74
     */
75
    public $mutableContent = null;
76
77
    /**
78
     * @param string|null $title
79
     * @param string|null $body
80
     * @param array $custom
81
     * @param null|int $badge
82
     *
83
     * @return static
84
     */
85 1
    public static function create($title = null, $body = null, $custom = [], $badge = null)
86
    {
87 1
        return new static($title, $body, $custom, $badge);
88
    }
89
90
    /**
91
     * @param string|null $title
92
     * @param string|null $body
93
     * @param array $custom
94
     * @param null|int $badge
95
     */
96 14
    public function __construct($title = null, $body = null, $custom = [], $badge = null)
97
    {
98 14
        $this->title = $title;
99 14
        $this->body = $body;
100 14
        $this->custom = $custom;
101 14
        $this->badge = $badge;
102 14
    }
103
104
    /**
105
     * Set the alert title of the notification.
106
     *
107
     * @param string $title
108
     *
109
     * @return $this
110
     */
111 1
    public function title($title)
112
    {
113 1
        $this->title = $title;
114
115 1
        return $this;
116
    }
117
118
    /**
119
     * Set the alert message of the notification.
120
     *
121
     * @param string $body
122
     *
123
     * @return $this
124
     */
125 1
    public function body($body)
126
    {
127 1
        $this->body = $body;
128
129 1
        return $this;
130
    }
131
132
    /**
133
     * Set the badge of the notification.
134
     *
135
     * @param int $badge
136
     *
137
     * @return $this
138
     */
139 1
    public function badge($badge)
140
    {
141 1
        $this->badge = $badge;
142
143 1
        return $this;
144
    }
145
146
    /**
147
     * Set the sound for the notification.
148
     *
149
     * @param string|null $sound
150
     *
151
     * @return $this
152
     */
153 2
    public function sound($sound = 'default')
154
    {
155 2
        $this->sound = $sound;
156
157 2
        return $this;
158
    }
159
160
    /**
161
     * Set category for this notification.
162
     *
163
     * @param string|null $category
164
     *
165
     * @return $this
166
     * */
167 1
    public function category($category)
168
    {
169 1
        $this->category = $category;
170
171 1
        return $this;
172
    }
173
174
    /**
175
     * Set content available value for this notification.
176
     *
177
     * @param int $value
178
     *
179
     * @return $this
180
     */
181 1
    public function contentAvailable($value = 1)
182
    {
183 1
        $this->contentAvailable = $value;
184
185 1
        return $this;
186
    }
187
188
    /**
189
     * Set the push type for this notification.
190
     *
191
     * @param  string  $pushType
192
     *
193
     * @return $this
194
     */
195 1
    public function pushType(string $pushType)
196
    {
197 1
        $this->pushType = $pushType;
0 ignored issues
show
Documentation Bug introduced by
It seems like $pushType of type string is incompatible with the declared type object<string> of property $pushType.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
198 1
    }
199
200
    /**
201
     * Add custom data to the notification.
202
     *
203
     * @param string $key
204
     * @param mixed $value
205
     *
206
     * @return $this
207
     */
208 2
    public function custom($key, $value)
209
    {
210 2
        $this->custom[$key] = $value;
211
212 2
        return $this;
213
    }
214
215
    /**
216
     * Override the data of the notification.
217
     *
218
     * @param array $custom
219
     *
220
     * @return $this
221
     */
222 1
    public function setCustom($custom)
223
    {
224 1
        $this->custom = $custom;
225
226 1
        return $this;
227
    }
228
229
    /**
230
     * Add an action to the notification.
231
     *
232
     * @param string $action
233
     * @param mixed $params
234
     *
235
     * @return $this
236
     */
237 1
    public function action($action, $params = null)
238
    {
239 1
        return $this->custom('action', [
240 1
            'action' => $action,
241 1
            'params' => $params,
242
        ]);
243
    }
244
245
    /**
246
     * Set message specific credentials.
247
     *
248
     * @param \NotificationChannels\Apn\ApnCredentials $credentials
249
     * @return $this
250
     */
251
    public function credentials(ApnCredentials $credentials)
252
    {
253
        $this->credentials = $credentials;
254
255
        return $this;
256
    }
257
258
    /**
259
     * Set mutable content value for this notification.
260
     *
261
     * @param int $value
262
     *
263
     * @return $this
264
     */
265 1
    public function mutableContent($value = 1)
266
    {
267 1
        $this->mutableContent = $value;
268
269 1
        return $this;
270
    }
271
}
272