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
Pull Request — master (#101)
by
unknown
03:31
created

ApnMessage::titleLocKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace NotificationChannels\Apn;
4
5
use DateTime;
6
use Pushok\Client;
7
8
class ApnMessage
9
{
10
    /**
11
     * The title of the notification.
12
     *
13
     * @var string
14
     */
15
    public $title;
16
17
    /**
18
     * The body of the notification.
19
     *
20
     * @var string
21
     */
22
    public $body;
23
24
    /**
25
     * The badge of the notification.
26
     *
27
     * @var int
28
     */
29
    public $badge;
30
31
    /**
32
     * The sound for the notification.
33
     *
34
     * @var string|null
35
     */
36
    public $sound;
37
38
    /**
39
     * The category for action button.
40
     *
41
     * @var string|null
42
     * */
43
    public $category;
44
45
    /**
46
     * Value indicating incoming resource in the notification.
47
     *
48
     * @var int|null
49
     */
50
    public $contentAvailable = null;
51
52
    /**
53
     * The key to a title string in the Localizable.strings file for the current localization.
54
     *
55
     * @var string|null
56
     */
57
    public $titleLocKey;
58
59
    /**
60
     * Variable string values to appear in place of the format specifiers in title-loc-key.
61
     *
62
     * @var string[]|null
63
     */
64
    public $titleLocArgs;
65
66
    /**
67
     * If a string is specified, the iOS system displays an alert that includes the Close and View buttons.
68
     *
69
     * @var string|null
70
     */
71
    public $actionLocKey;
72
73
    /**
74
     * A key to an alert-message string in a Localizable.strings file for the current localization.
75
     *
76
     * @var string
77
     */
78
    public $locKey;
79
80
    /**
81
     * Variable string values to appear in place of the format specifiers in loc-key.
82
     *
83
     * @var array
84
     */
85
    public $locArgs;
86
87
    /**
88
     * Additional data of the notification.
89
     *
90
     * @var array
91
     */
92
    public $custom = [];
93
94
    /**
95
     * Value indicating when the message will expire.
96
     *
97
     * @var \string
98
     */
99
    public $pushType = null;
100
101
    /**
102
     * The expiration time of the notification.
103
     *
104
     * @var \DateTime|null
105
     */
106
    public $expiresAt = null;
107
108
    /**
109
     * Message specific client.
110
     *
111
     * @var \Pushok\Client|null
112
     */
113
    public $client = null;
114
115
    /**
116
     * The notification service app extension flag.
117
     *
118
     * @var int|null
119
     */
120
    public $mutableContent = null;
121
122
    /**
123
     * @param string|null $title
124
     * @param string|null $body
125
     * @param array $custom
126
     * @param null|int $badge
127
     *
128
     * @return static
129
     */
130 1
    public static function create($title = null, $body = null, $custom = [], $badge = null)
131
    {
132 1
        return new static($title, $body, $custom, $badge);
133
    }
134
135
    /**
136
     * @param string|null $title
137
     * @param string|null $body
138
     * @param array $custom
139
     * @param null|int $badge
140
     */
141 32
    public function __construct($title = null, $body = null, $custom = [], $badge = null)
142
    {
143 32
        $this->title = $title;
144 32
        $this->body = $body;
145 32
        $this->custom = $custom;
146 32
        $this->badge = $badge;
147 32
    }
148
149
    /**
150
     * Set the alert title of the notification.
151
     *
152
     * @param string $title
153
     *
154
     * @return $this
155
     */
156 2
    public function title($title)
157
    {
158 2
        $this->title = $title;
159
160 2
        return $this;
161
    }
162
163
    /**
164
     * Set the alert message of the notification.
165
     *
166
     * @param string $body
167
     *
168
     * @return $this
169
     */
170 2
    public function body($body)
171
    {
172 2
        $this->body = $body;
173
174 2
        return $this;
175
    }
176
177
    /**
178
     * Set the badge of the notification.
179
     *
180
     * @param int $badge
181
     *
182
     * @return $this
183
     */
184 2
    public function badge($badge)
185
    {
186 2
        $this->badge = $badge;
187
188 2
        return $this;
189
    }
190
191
    /**
192
     * Set the sound for the notification.
193
     *
194
     * @param string|null $sound
195
     *
196
     * @return $this
197
     */
198 3
    public function sound($sound = 'default')
199
    {
200 3
        $this->sound = $sound;
201
202 3
        return $this;
203
    }
204
205
    /**
206
     * Set category for this notification.
207
     *
208
     * @param string|null $category
209
     *
210
     * @return $this
211
     * */
212 2
    public function category($category)
213
    {
214 2
        $this->category = $category;
215
216 2
        return $this;
217
    }
218
219
    /**
220
     * Set content available value for this notification.
221
     *
222
     * @param int $value
223
     *
224
     * @return $this
225
     */
226 2
    public function contentAvailable($value = 1)
227
    {
228 2
        $this->contentAvailable = $value;
229
230 2
        return $this;
231
    }
232
233
    /**
234
     * Set the push type for this notification.
235
     *
236
     * @param  string $pushType
237
     *
238
     * @return $this
239
     */
240 5
    public function pushType(string $pushType)
241
    {
242 5
        $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...
243
244 5
        return $this;
245
    }
246
247
    /**
248
     * Set the expiration time for the message.
249
     *
250
     * @param  \DateTime $expiresAt
251
     *
252
     * @return $this
253
     */
254 2
    public function expiresAt(DateTime $expiresAt)
255
    {
256 2
        $this->expiresAt = $expiresAt;
257
258 2
        return $this;
259
    }
260
261
    /**
262
     * Set a title-loc-key.
263
     *
264
     * @param  string|null $titleLocKey
265
     * @return $this
266
     */
267
    public function titleLocKey($titleLocKey = null)
268
    {
269
        $this->titleLocKey = $titleLocKey;
270
        return $this;
271
    }
272
273
    /**
274
     * Set the title-loc-args.
275
     *
276
     * @param  array|null $titleLocArgs
277
     * @return $this
278
     */
279
    public function titleLocArgs(array $titleLocArgs = null)
280
    {
281
        $this->titleLocArgs = $titleLocArgs;
282
        return $this;
283
    }
284
285
    /**
286
     * Set an action-loc-key.
287
     *
288
     * @param  string|null $actionLocKey
289
     * @return $this
290
     */
291
    public function actionLocKey($actionLocKey = null)
292
    {
293
        $this->actionLocKey = $actionLocKey;
294
        return $this;
295
    }
296
297
    /**
298
     * Set a loc-key.
299
     *
300
     * @param  string $locKey
301
     * @return $this
302
     */
303
    public function setLocKey($locKey)
304
    {
305
        $this->locKey = $locKey;
306
        return $this;
307
    }
308
309
    /**
310
     * Set the loc-args.
311
     *
312
     * @param  array $locArgs
313
     * @return $this
314
     */
315
    public function setLocArgs($locArgs)
316
    {
317
        $this->locArgs = $locArgs;
318
        return $this;
319
    }
320
321
    /**
322
     * Add custom data to the notification.
323
     *
324
     * @param string $key
325
     * @param mixed $value
326
     *
327
     * @return $this
328
     */
329 3
    public function custom($key, $value)
330
    {
331 3
        $this->custom[$key] = $value;
332
333 3
        return $this;
334
    }
335
336
    /**
337
     * Override the data of the notification.
338
     *
339
     * @param array $custom
340
     *
341
     * @return $this
342
     */
343 1
    public function setCustom($custom)
344
    {
345 1
        $this->custom = $custom;
346
347 1
        return $this;
348
    }
349
350
    /**
351
     * Add an action to the notification.
352
     *
353
     * @param string $action
354
     * @param mixed $params
355
     *
356
     * @return $this
357
     */
358 1
    public function action($action, $params = null)
359
    {
360 1
        return $this->custom('action', [
361 1
            'action' => $action,
362 1
            'params' => $params,
363
        ]);
364
    }
365
366
    /**
367
     * Set message specific client.
368
     *
369
     * @param \Pushok\Client
370
     * @return $this
371
     */
372 3
    public function via(Client $client)
373
    {
374 3
        $this->client = $client;
375
376 3
        return $this;
377
    }
378
379
    /**
380
     * Set mutable content value for this notification.
381
     *
382
     * @param int $value
383
     *
384
     * @return $this
385
     */
386 2
    public function mutableContent($value = 1)
387
    {
388 2
        $this->mutableContent = $value;
389
390 2
        return $this;
391
    }
392
}
393