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 (#87)
by
unknown
03:40
created

WebPushMessage::requireInteraction()   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\WebPush;
4
5
/**
6
 * @link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification#Parameters
7
 */
8
class WebPushMessage
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $title;
14
15
    /**
16
     * @var array
17
     */
18
    protected $actions = [];
19
20
    /**
21
     * @var string
22
     */
23
    protected $badge;
24
25
    /**
26
     * @var string
27
     */
28
    protected $body;
29
30
    /**
31
     * @var string
32
     */
33
    protected $dir;
34
35
    /**
36
     * @var string
37
     */
38
    protected $icon;
39
40
    /**
41
     * @var string
42
     */
43
    protected $image;
44
45
    /**
46
     * @var string
47
     */
48
    protected $lang;
49
50
    /**
51
     * @var bool
52
     */
53
    protected $renotify;
54
55
    /**
56
     * @var bool
57
     */
58
    protected $requireInteraction;
59
60
    /**
61
     * @var string
62
     */
63
    protected $tag;
64
65
    /**
66
     * @var array
67
     */
68
    protected $vibrate;
69
70
    /**
71
     * @var mixed
72
     */
73
    protected $data;
74
75
    /**
76
     * @var mixed
77
     */
78
    protected $options;
79
80
    /**
81
     * Set the notification title.
82
     *
83
     * @param  string $value
84
     * @return $this
85
     */
86 4
    public function title($value)
87
    {
88 4
        $this->title = $value;
89
90 4
        return $this;
91
    }
92
93
    /**
94
     * Add a notification action.
95
     *
96
     * @param  string $title
97
     * @param  string $action
98
     * @return $this
99
     */
100 4
    public function action($title, $action)
101
    {
102 4
        $this->actions[] = compact('title', 'action');
103
104 4
        return $this;
105
    }
106
107
    /**
108
     * Set the notification badge.
109
     *
110
     * @param  string $value
111
     * @return $this
112
     */
113 1
    public function badge($value)
114
    {
115 1
        $this->badge = $value;
116
117 1
        return $this;
118
    }
119
120
    /**
121
     * Set the notification body.
122
     *
123
     * @param  string $value
124
     * @return $this
125
     */
126 4
    public function body($value)
127
    {
128 4
        $this->body = $value;
129
130 4
        return $this;
131
    }
132
133
    /**
134
     * Set the notification direction.
135
     *
136
     * @param  string $value
137
     * @return $this
138
     */
139 1
    public function dir($value)
140
    {
141 1
        $this->dir = $value;
142
143 1
        return $this;
144
    }
145
146
    /**
147
     * Set the notification icon url.
148
     *
149
     * @param  string $value
150
     * @return $this
151
     */
152 4
    public function icon($value)
153
    {
154 4
        $this->icon = $value;
155
156 4
        return $this;
157
    }
158
159
    /**
160
     * Set the notification image url.
161
     *
162
     * @param  string $value
163
     * @return $this
164
     */
165 1
    public function image($value)
166
    {
167 1
        $this->image = $value;
168
169 1
        return $this;
170
    }
171
172
    /**
173
     * Set the notification language.
174
     *
175
     * @param  string $value
176
     * @return $this
177
     */
178 1
    public function lang($value)
179
    {
180 1
        $this->lang = $value;
181
182 1
        return $this;
183
    }
184
185
    /**
186
     * @param  bool $value
187
     * @return $this
188
     */
189 1
    public function renotify($value = true)
190
    {
191 1
        $this->renotify = $value;
192
193 1
        return $this;
194
    }
195
196
    /**
197
     * @param  bool $value
198
     * @return $this
199
     */
200 1
    public function requireInteraction($value = true)
201
    {
202 1
        $this->requireInteraction = $value;
203
204 1
        return $this;
205
    }
206
207
    /**
208
     * Set the notification tag.
209
     *
210
     * @param  string $value
211
     * @return $this
212
     */
213 1
    public function tag($value)
214
    {
215 1
        $this->tag = $value;
216
217 1
        return $this;
218
    }
219
220
    /**
221
     * Set the notification vibration pattern.
222
     *
223
     * @param  array $value
224
     * @return $this
225
     */
226 1
    public function vibrate($value)
227
    {
228 1
        $this->vibrate = $value;
229
230 1
        return $this;
231
    }
232
233
    /**
234
     * Set the notification arbitrary data.
235
     *
236
     * @param  mixed $value
237
     * @return $this
238
     */
239 4
    public function data($value)
240
    {
241 4
        $this->data = $value;
242
243 4
        return $this;
244
    }
245
246
    /**
247
     * Set the notification options.
248
     *
249
     * @param  mixed $value
250
     * @return $this
251
     */
252 2
    public function options($value)
253
    {
254 2
        $this->options = $value;
255
256 2
        return $this;
257
    }
258
259
    /**
260
     * Get an array representation of the message.
261
     *
262
     * @return array
263
     */
264 17
    public function toArray()
265
    {
266 17
        return array_filter(get_object_vars($this));
267
    }
268
}
269