1 | <?php |
||
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) |
|
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) |
|
106 | |||
107 | /** |
||
108 | * Set the notification badge. |
||
109 | * |
||
110 | * @param string $value |
||
111 | * @return $this |
||
112 | */ |
||
113 | 1 | public function badge($value) |
|
119 | |||
120 | /** |
||
121 | * Set the notification body. |
||
122 | * |
||
123 | * @param string $value |
||
124 | * @return $this |
||
125 | */ |
||
126 | 4 | public function body($value) |
|
132 | |||
133 | /** |
||
134 | * Set the notification direction. |
||
135 | * |
||
136 | * @param string $value |
||
137 | * @return $this |
||
138 | */ |
||
139 | 1 | public function dir($value) |
|
145 | |||
146 | /** |
||
147 | * Set the notification icon url. |
||
148 | * |
||
149 | * @param string $value |
||
150 | * @return $this |
||
151 | */ |
||
152 | 4 | public function icon($value) |
|
158 | |||
159 | /** |
||
160 | * Set the notification image url. |
||
161 | * |
||
162 | * @param string $value |
||
163 | * @return $this |
||
164 | */ |
||
165 | 1 | public function image($value) |
|
171 | |||
172 | /** |
||
173 | * Set the notification language. |
||
174 | * |
||
175 | * @param string $value |
||
176 | * @return $this |
||
177 | */ |
||
178 | 1 | public function lang($value) |
|
184 | |||
185 | /** |
||
186 | * @param bool $value |
||
187 | * @return $this |
||
188 | */ |
||
189 | 1 | public function renotify($value = true) |
|
195 | |||
196 | /** |
||
197 | * @param bool $value |
||
198 | * @return $this |
||
199 | */ |
||
200 | 1 | public function requireInteraction($value = true) |
|
206 | |||
207 | /** |
||
208 | * Set the notification tag. |
||
209 | * |
||
210 | * @param string $value |
||
211 | * @return $this |
||
212 | */ |
||
213 | 1 | public function tag($value) |
|
219 | |||
220 | /** |
||
221 | * Set the notification vibration pattern. |
||
222 | * |
||
223 | * @param array $value |
||
224 | * @return $this |
||
225 | */ |
||
226 | 1 | public function vibrate($value) |
|
232 | |||
233 | /** |
||
234 | * Set the notification arbitrary data. |
||
235 | * |
||
236 | * @param mixed $value |
||
237 | * @return $this |
||
238 | */ |
||
239 | 4 | public function data($value) |
|
245 | |||
246 | /** |
||
247 | * Set the notification options. |
||
248 | * |
||
249 | * @param mixed $value |
||
250 | * @return $this |
||
251 | */ |
||
252 | 2 | public function options($value) |
|
258 | |||
259 | /** |
||
260 | * Get an array representation of the message. |
||
261 | * |
||
262 | * @return array |
||
263 | */ |
||
264 | 17 | public function toArray() |
|
268 | } |
||
269 |