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 ( 4e1a26...3707bf )
by Dwight
02:57 queued 43s
created

ApnMessage::expiresAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
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
     * Additional data of the notification.
54
     *
55
     * @var array
56
     */
57
    public $custom = [];
58
59
    /**
60
     * Value indicating when the message will expire.
61
     *
62
     * @var \string
63
     */
64
    public $pushType = null;
65
66
    /**
67
     * The expiration time of the notification.
68
     *
69
     * @var \DateTime|null
70
     */
71
    public $expiresAt = null;
72
73
    /**
74
     * Message specific client.
75
     *
76
     * @var \Pushok\Client|null
77
     */
78
    public $client = null;
79
80
    /**
81
     * The notification service app extension flag.
82
     *
83
     * @var int|null
84
     */
85
    public $mutableContent = null;
86
87
    /**
88
     * @param string|null $title
89
     * @param string|null $body
90
     * @param array $custom
91
     * @param null|int $badge
92
     *
93
     * @return static
94
     */
95 1
    public static function create($title = null, $body = null, $custom = [], $badge = null)
96
    {
97 1
        return new static($title, $body, $custom, $badge);
98
    }
99
100
    /**
101
     * @param string|null $title
102
     * @param string|null $body
103
     * @param array $custom
104
     * @param null|int $badge
105
     */
106 16
    public function __construct($title = null, $body = null, $custom = [], $badge = null)
107
    {
108 16
        $this->title = $title;
109 16
        $this->body = $body;
110 16
        $this->custom = $custom;
111 16
        $this->badge = $badge;
112 16
    }
113
114
    /**
115
     * Set the alert title of the notification.
116
     *
117
     * @param string $title
118
     *
119
     * @return $this
120
     */
121 1
    public function title($title)
122
    {
123 1
        $this->title = $title;
124
125 1
        return $this;
126
    }
127
128
    /**
129
     * Set the alert message of the notification.
130
     *
131
     * @param string $body
132
     *
133
     * @return $this
134
     */
135 1
    public function body($body)
136
    {
137 1
        $this->body = $body;
138
139 1
        return $this;
140
    }
141
142
    /**
143
     * Set the badge of the notification.
144
     *
145
     * @param int $badge
146
     *
147
     * @return $this
148
     */
149 1
    public function badge($badge)
150
    {
151 1
        $this->badge = $badge;
152
153 1
        return $this;
154
    }
155
156
    /**
157
     * Set the sound for the notification.
158
     *
159
     * @param string|null $sound
160
     *
161
     * @return $this
162
     */
163 2
    public function sound($sound = 'default')
164
    {
165 2
        $this->sound = $sound;
166
167 2
        return $this;
168
    }
169
170
    /**
171
     * Set category for this notification.
172
     *
173
     * @param string|null $category
174
     *
175
     * @return $this
176
     * */
177 1
    public function category($category)
178
    {
179 1
        $this->category = $category;
180
181 1
        return $this;
182
    }
183
184
    /**
185
     * Set content available value for this notification.
186
     *
187
     * @param int $value
188
     *
189
     * @return $this
190
     */
191 1
    public function contentAvailable($value = 1)
192
    {
193 1
        $this->contentAvailable = $value;
194
195 1
        return $this;
196
    }
197
198
    /**
199
     * Set the push type for this notification.
200
     *
201
     * @param  string  $pushType
202
     *
203
     * @return $this
204
     */
205 1
    public function pushType(string $pushType)
206
    {
207 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...
208
209 1
        return $this;
210
    }
211
212
    /**
213
     * Set the expiration time for the message.
214
     *
215
     * @param  \DateTime  $expiresAt
216
     *
217
     * @return $this
218
     */
219 1
    public function expiresAt(DateTime $expiresAt)
220
    {
221 1
        $this->expiresAt = $expiresAt;
222
223 1
        return $this;
224
    }
225
226
    /**
227
     * Add custom data to the notification.
228
     *
229
     * @param string $key
230
     * @param mixed $value
231
     *
232
     * @return $this
233
     */
234 2
    public function custom($key, $value)
235
    {
236 2
        $this->custom[$key] = $value;
237
238 2
        return $this;
239
    }
240
241
    /**
242
     * Override the data of the notification.
243
     *
244
     * @param array $custom
245
     *
246
     * @return $this
247
     */
248 1
    public function setCustom($custom)
249
    {
250 1
        $this->custom = $custom;
251
252 1
        return $this;
253
    }
254
255
    /**
256
     * Add an action to the notification.
257
     *
258
     * @param string $action
259
     * @param mixed $params
260
     *
261
     * @return $this
262
     */
263 1
    public function action($action, $params = null)
264
    {
265 1
        return $this->custom('action', [
266 1
            'action' => $action,
267 1
            'params' => $params,
268
        ]);
269
    }
270
271
    /**
272
     * Set message specific client.
273
     *
274
     * @param \Pushok\Client
275
     * @return $this
276
     */
277 1
    public function via(Client $client)
278
    {
279 1
        $this->client = $client;
280
281 1
        return $this;
282
    }
283
284
    /**
285
     * Set mutable content value for this notification.
286
     *
287
     * @param int $value
288
     *
289
     * @return $this
290
     */
291 1
    public function mutableContent($value = 1)
292
    {
293 1
        $this->mutableContent = $value;
294
295 1
        return $this;
296
    }
297
}
298