1 | <?php |
||
5 | class ApnMessage |
||
6 | { |
||
7 | /** |
||
8 | * The title of the notification. |
||
9 | * |
||
10 | * @var string |
||
11 | */ |
||
12 | public $title; |
||
13 | |||
14 | /** |
||
15 | * The subtitle of the notification. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | public $subtitle; |
||
20 | |||
21 | /** |
||
22 | * The body of the notification. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | public $body; |
||
27 | |||
28 | /** |
||
29 | * The badge of the notification. |
||
30 | * |
||
31 | * @var int |
||
32 | */ |
||
33 | public $badge; |
||
34 | |||
35 | /** |
||
36 | * The sound for the notification. |
||
37 | * |
||
38 | * @var string|null |
||
39 | */ |
||
40 | public $sound; |
||
41 | |||
42 | /** |
||
43 | * The category for action button. |
||
44 | * |
||
45 | * @var string|null |
||
46 | * */ |
||
47 | public $category; |
||
48 | |||
49 | /** |
||
50 | * Provide this key with a string value that represents the app-specific identifier for grouping notifications. |
||
51 | * |
||
52 | * @var string |
||
53 | */ |
||
54 | public $threadId; |
||
55 | |||
56 | /** |
||
57 | * Additional data of the notification. |
||
58 | * |
||
59 | * @var array |
||
60 | */ |
||
61 | public $custom = []; |
||
62 | |||
63 | /** |
||
64 | * The key to a title string in the Localizable.strings file for the current localization. |
||
65 | * |
||
66 | * @var string|null |
||
67 | */ |
||
68 | public $titleLocKey; |
||
69 | |||
70 | /** |
||
71 | * Variable string values to appear in place of the format specifiers in title-loc-key. |
||
72 | * |
||
73 | * @var string[]|null |
||
74 | */ |
||
75 | public $titleLocArgs; |
||
76 | |||
77 | /** |
||
78 | * If a string is specified, the iOS system displays an alert that includes the Close and View buttons. |
||
79 | * |
||
80 | * @var string|null |
||
81 | */ |
||
82 | public $actionLocKey; |
||
83 | |||
84 | /** |
||
85 | * A key to an alert-message string in a Localizable.strings file for the current localization. |
||
86 | * |
||
87 | * @var string |
||
88 | */ |
||
89 | public $locKey; |
||
90 | |||
91 | /** |
||
92 | * Variable string values to appear in place of the format specifiers in loc-key. |
||
93 | * |
||
94 | * @var array |
||
95 | */ |
||
96 | public $locArgs; |
||
97 | |||
98 | /** |
||
99 | * The filename of an image file in the app bundle, with or without the filename extension. |
||
100 | * |
||
101 | * @var string |
||
102 | */ |
||
103 | public $launchImage; |
||
104 | |||
105 | /** |
||
106 | * Value indicating incoming resource in the notification. |
||
107 | * |
||
108 | * @var bool|null |
||
109 | */ |
||
110 | protected $contentAvailable; |
||
111 | |||
112 | /** |
||
113 | * Include this key with a value of true to configure a mutable content notification. |
||
114 | * |
||
115 | * @var bool |
||
116 | */ |
||
117 | protected $mutableContent; |
||
118 | |||
119 | /** |
||
120 | * Create an instance of APN message. |
||
121 | * |
||
122 | * @param string|null $title |
||
123 | * @param string|null $body |
||
124 | * @param int|null $badge |
||
125 | * @return static |
||
126 | */ |
||
127 | public static function create($title = null, $body = null, $badge = null) |
||
131 | |||
132 | /** |
||
133 | * Create an instance of APN message. |
||
134 | * |
||
135 | * @param string|null $title |
||
136 | * @param string|null $body |
||
137 | * @param int|null $badge |
||
138 | * @return void |
||
|
|||
139 | */ |
||
140 | public function __construct($title = null, $body = null, $badge = null) |
||
146 | |||
147 | /** |
||
148 | * Set a title. |
||
149 | * |
||
150 | * @param string $title |
||
151 | * @return $this |
||
152 | */ |
||
153 | public function title($title) |
||
159 | |||
160 | /** |
||
161 | * Set a subtitle. |
||
162 | * |
||
163 | * @param string $subtitle |
||
164 | * @return $this |
||
165 | */ |
||
166 | public function subtitle($subtitle) |
||
172 | |||
173 | /** |
||
174 | * Set a body. |
||
175 | * |
||
176 | * @param string $body |
||
177 | * @return $this |
||
178 | */ |
||
179 | public function body($body) |
||
185 | |||
186 | /** |
||
187 | * Set a badge. |
||
188 | * |
||
189 | * @param int $badge |
||
190 | * @return $this |
||
191 | */ |
||
192 | public function badge($badge) |
||
198 | |||
199 | /** |
||
200 | * Set a sound. |
||
201 | * |
||
202 | * @param string|null $sound |
||
203 | * @return $this |
||
204 | */ |
||
205 | public function sound($sound = 'default') |
||
211 | |||
212 | /** |
||
213 | * Set a category. |
||
214 | * |
||
215 | * @param string|null $category |
||
216 | * @return $this |
||
217 | */ |
||
218 | public function category($category) |
||
224 | |||
225 | /** |
||
226 | * Set a title-loc-key. |
||
227 | * |
||
228 | * @param string|null $titleLocKey |
||
229 | * @return $this |
||
230 | */ |
||
231 | public function titleLocKey($titleLocKey = null) |
||
237 | |||
238 | /** |
||
239 | * Set the title-loc-args. |
||
240 | * |
||
241 | * @param array|null $titleLocArgs |
||
242 | * @return $this |
||
243 | */ |
||
244 | public function titleLocArgs(array $titleLocArgs = null) |
||
250 | |||
251 | /** |
||
252 | * Set an action-loc-key. |
||
253 | * |
||
254 | * @param string|null $actionLocKey |
||
255 | * @return $this |
||
256 | */ |
||
257 | public function actionLocKey($actionLocKey = null) |
||
263 | |||
264 | /** |
||
265 | * Set a loc-key. |
||
266 | * |
||
267 | * @param string $locKey |
||
268 | * @return $this |
||
269 | */ |
||
270 | public function setLocKey($locKey) |
||
276 | |||
277 | /** |
||
278 | * Set the loc-args. |
||
279 | * |
||
280 | * @param array $locArgs |
||
281 | * @return $this |
||
282 | */ |
||
283 | public function setLocArgs($locArgs) |
||
289 | |||
290 | /** |
||
291 | * Set a launch-image. |
||
292 | * |
||
293 | * @param string $launchImage |
||
294 | * @return $this |
||
295 | */ |
||
296 | public function launchImage($launchImage) |
||
302 | |||
303 | /** |
||
304 | * Set a content availability. |
||
305 | * |
||
306 | * @param bool|null $value |
||
307 | * @return $this |
||
308 | */ |
||
309 | public function contentAvailability($value = true) |
||
315 | |||
316 | /** |
||
317 | * Get a content availability. |
||
318 | * |
||
319 | * @return bool|null |
||
320 | */ |
||
321 | public function isContentAvailable() |
||
325 | |||
326 | /** |
||
327 | * Set the mutable-content key for Notification Service Extensions on iOS10. |
||
328 | * @see http://bit.ly/mutable-content |
||
329 | * |
||
330 | * @param bool $value |
||
331 | * @return $this |
||
332 | */ |
||
333 | public function mutableContent($value = true) |
||
339 | |||
340 | /** |
||
341 | * Determine the content is mutable. |
||
342 | * |
||
343 | * @return bool|null |
||
344 | */ |
||
345 | public function hasMutableContent() |
||
349 | |||
350 | /** |
||
351 | * Set a thread ID. |
||
352 | * |
||
353 | * @param string $threadId |
||
354 | * @return $this |
||
355 | */ |
||
356 | public function threadId($threadId) |
||
362 | |||
363 | /** |
||
364 | * Add custom data to the notification. |
||
365 | * |
||
366 | * @param string $key |
||
367 | * @param mixed $value |
||
368 | * @return $this |
||
369 | */ |
||
370 | public function custom($key, $value) |
||
376 | |||
377 | /** |
||
378 | * Override the custom data of the notification. |
||
379 | * |
||
380 | * @param array $custom |
||
381 | * @return $this |
||
382 | */ |
||
383 | public function setCustom($custom) |
||
389 | } |
||
390 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.