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 ( 6e8b8a...3f3148 )
by Cretu
03:22
created

WebPushMessage::getOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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