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 | * Set the notification title. |
||
77 | * |
||
78 | * @param string $value |
||
79 | * @return $this |
||
80 | */ |
||
81 | 3 | public function title($value) |
|
87 | |||
88 | /** |
||
89 | * Add a notification action. |
||
90 | * |
||
91 | * @param string $title |
||
92 | * @param string $action |
||
93 | * @return $this |
||
94 | */ |
||
95 | 3 | public function action($title, $action) |
|
101 | |||
102 | /** |
||
103 | * Set the notification badge. |
||
104 | * |
||
105 | * @param string $value |
||
106 | * @return $this |
||
107 | */ |
||
108 | 1 | public function badge($value) |
|
114 | |||
115 | /** |
||
116 | * Set the notification body. |
||
117 | * |
||
118 | * @param string $value |
||
119 | * @return $this |
||
120 | */ |
||
121 | 3 | public function body($value) |
|
127 | |||
128 | /** |
||
129 | * Set the notification direction. |
||
130 | * |
||
131 | * @param string $value |
||
132 | * @return $this |
||
133 | */ |
||
134 | 1 | public function dir($value) |
|
140 | |||
141 | /** |
||
142 | * Set the notification icon url. |
||
143 | * |
||
144 | * @param string $value |
||
145 | * @return $this |
||
146 | */ |
||
147 | 3 | public function icon($value) |
|
153 | |||
154 | /** |
||
155 | * Set the notification image url. |
||
156 | * |
||
157 | * @param string $value |
||
158 | * @return $this |
||
159 | */ |
||
160 | 1 | public function image($value) |
|
166 | |||
167 | /** |
||
168 | * Set the notification language. |
||
169 | * |
||
170 | * @param string $value |
||
171 | * @return $this |
||
172 | */ |
||
173 | 1 | public function lang($value) |
|
179 | |||
180 | /** |
||
181 | * @param bool $value |
||
182 | * @return $this |
||
183 | */ |
||
184 | 1 | public function renotify($value = true) |
|
190 | |||
191 | /** |
||
192 | * @param bool $value |
||
193 | * @return $this |
||
194 | */ |
||
195 | 1 | public function requireInteraction($value = true) |
|
201 | |||
202 | /** |
||
203 | * Set the notification tag. |
||
204 | * |
||
205 | * @param string $value |
||
206 | * @return $this |
||
207 | */ |
||
208 | 1 | public function tag($value) |
|
214 | |||
215 | /** |
||
216 | * Set the notification vibration pattern. |
||
217 | * |
||
218 | * @param array $value |
||
219 | * @return $this |
||
220 | */ |
||
221 | 1 | public function vibrate($value) |
|
227 | |||
228 | /** |
||
229 | * Set the notification arbitrary data. |
||
230 | * |
||
231 | * @param mixed $value |
||
232 | * @return $this |
||
233 | */ |
||
234 | 3 | public function data($value) |
|
240 | |||
241 | /** |
||
242 | * Get an array representation of the message. |
||
243 | * |
||
244 | * @return array |
||
245 | */ |
||
246 | 15 | public function toArray() |
|
271 | } |
||
272 |