1 | <?php |
||
21 | class Alert implements \JsonSerializable |
||
22 | { |
||
23 | const ALERT_TITLE_KEY = 'title'; |
||
24 | const ALERT_BODY_KEY = 'body'; |
||
25 | const ALERT_TITLE_LOC_KEY = 'title-loc-key'; |
||
26 | const ALERT_TITLE_LOC_ARGS_KEY = 'title-loc-args'; |
||
27 | const ALERT_ACTION_LOC_KEY = 'action-loc-key'; |
||
28 | const ALERT_LOC_KEY = 'loc-key'; |
||
29 | const ALERT_LOC_ARGS_KEY = 'loc-args'; |
||
30 | const ALERT_LAUNCH_IMAGE_KEY = 'launch-image'; |
||
31 | const ALERT_MUTABLE_CONTENT_KEY = 'mutable-content'; |
||
32 | |||
33 | /** |
||
34 | * A short string describing the purpose of the notification. |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | private $title; |
||
39 | |||
40 | /** |
||
41 | * A subtitle. |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | private $subtitle; |
||
46 | |||
47 | /** |
||
48 | * The text of the alert message. |
||
49 | * |
||
50 | * @var string |
||
51 | */ |
||
52 | private $body; |
||
53 | |||
54 | /** |
||
55 | * The key to a title string in the Localizable.strings file for the current localization. |
||
56 | * |
||
57 | * @var string|null |
||
58 | */ |
||
59 | private $titleLocKey; |
||
60 | |||
61 | /** |
||
62 | * Variable string values to appear in place of the format specifiers in title-loc-key. |
||
63 | * |
||
64 | * @var string[]|null |
||
65 | */ |
||
66 | private $titleLocArgs; |
||
67 | |||
68 | /** |
||
69 | * If a string is specified, the iOS system displays an alert that includes the Close and View buttons. |
||
70 | * |
||
71 | * @var string|null |
||
72 | */ |
||
73 | private $actionLocKey; |
||
74 | |||
75 | /** |
||
76 | * A key to an alert-message string in a Localizable.strings file for the current localization. |
||
77 | * |
||
78 | * @var string |
||
79 | */ |
||
80 | private $locKey; |
||
81 | |||
82 | /** |
||
83 | * Variable string values to appear in place of the format specifiers in loc-key. |
||
84 | * |
||
85 | * @var string[] |
||
86 | */ |
||
87 | private $locArgs; |
||
88 | |||
89 | /** |
||
90 | * The filename of an image file in the app bundle, with or without the filename extension. |
||
91 | * |
||
92 | * @var string |
||
93 | */ |
||
94 | private $launchImage; |
||
95 | |||
96 | /** |
||
97 | * Access to modify the content of remote notifications before they are delivered to the user. |
||
98 | * |
||
99 | * @var bool |
||
100 | */ |
||
101 | private $mutableContent; |
||
102 | |||
103 | protected function __construct() |
||
106 | |||
107 | public static function create() |
||
111 | |||
112 | /** |
||
113 | * Set Alert title. |
||
114 | * |
||
115 | * @param string $value |
||
116 | * @return Alert |
||
117 | */ |
||
118 | public function setTitle(string $value): Alert |
||
124 | |||
125 | /** |
||
126 | * Get Alert title. |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | public function getTitle() |
||
134 | |||
135 | /** |
||
136 | * Set Alert title. |
||
137 | * |
||
138 | * @param string $value |
||
139 | * @return Alert |
||
140 | */ |
||
141 | public function setSubtitle(string $value): Alert |
||
147 | |||
148 | /** |
||
149 | * Get Alert subtitle. |
||
150 | * |
||
151 | * @return string |
||
152 | */ |
||
153 | public function getSubtitle() |
||
157 | |||
158 | /** |
||
159 | * Set Alert body. |
||
160 | * |
||
161 | * @param string $value |
||
162 | * @return Alert |
||
163 | */ |
||
164 | public function setBody(string $value): Alert |
||
170 | |||
171 | /** |
||
172 | * Get Alert body. |
||
173 | * |
||
174 | * @return string |
||
175 | */ |
||
176 | public function getBody() |
||
180 | |||
181 | /** |
||
182 | * Set title-loc-key. |
||
183 | * |
||
184 | * @param string|null $value |
||
185 | * @return Alert |
||
186 | */ |
||
187 | public function setTitleLocKey(string $value = null): Alert |
||
193 | |||
194 | /** |
||
195 | * Get title-loc-key. |
||
196 | * |
||
197 | * @return string |
||
198 | */ |
||
199 | public function getTitleLocKey() |
||
203 | |||
204 | /** |
||
205 | * Set title-loc-args. |
||
206 | * |
||
207 | * @param array|null $value |
||
208 | * @return Alert |
||
209 | */ |
||
210 | public function setTitleLocArgs(array $value = null): Alert |
||
216 | |||
217 | /** |
||
218 | * Get title-loc-args. |
||
219 | * |
||
220 | * @return string[]|null |
||
221 | */ |
||
222 | public function getTitleLocArgs() |
||
226 | |||
227 | /** |
||
228 | * Set action-loc-key. |
||
229 | * |
||
230 | * @param string|null $value |
||
231 | * @return Alert |
||
232 | */ |
||
233 | public function setActionLocKey(string $value = null): Alert |
||
239 | |||
240 | /** |
||
241 | * Get action-loc-key. |
||
242 | * |
||
243 | * @return string|null |
||
244 | */ |
||
245 | public function getActionLocKey() |
||
249 | |||
250 | /** |
||
251 | * Set loc-key. |
||
252 | * |
||
253 | * @param string $value |
||
254 | * @return Alert |
||
255 | */ |
||
256 | public function setLocKey(string $value): Alert |
||
262 | |||
263 | /** |
||
264 | * Get loc-key. |
||
265 | * |
||
266 | * @return string |
||
267 | */ |
||
268 | public function getLocKey() |
||
272 | |||
273 | /** |
||
274 | * Set loc-args. |
||
275 | * |
||
276 | * @param array $value |
||
277 | * @return Alert |
||
278 | */ |
||
279 | public function setLocArgs(array $value): Alert |
||
285 | |||
286 | /** |
||
287 | * Get loc-args. |
||
288 | * |
||
289 | * @return string[] |
||
290 | */ |
||
291 | public function getLocArgs() |
||
295 | |||
296 | /** |
||
297 | * Set launch-image. |
||
298 | * |
||
299 | * @param string $value |
||
300 | * @return $this |
||
301 | */ |
||
302 | public function setLaunchImage(string $value) |
||
308 | |||
309 | /** |
||
310 | * Get launch-image. |
||
311 | * |
||
312 | * @return string |
||
313 | */ |
||
314 | public function getLaunchImage() |
||
318 | |||
319 | /** |
||
320 | * Set the mutable-content key for Notification Service Extensions on iOS10. |
||
321 | * @see http://bit.ly/mutable-content |
||
322 | * |
||
323 | * @param bool $value |
||
324 | * @return Alert |
||
325 | */ |
||
326 | public function setMutableContent(bool $value): Alert |
||
332 | |||
333 | /** |
||
334 | * Is content mutable. |
||
335 | * |
||
336 | * @return bool|null |
||
337 | */ |
||
338 | public function hasMutableContent() |
||
342 | |||
343 | /** |
||
344 | * Convert Alert to JSON. |
||
345 | * |
||
346 | * @return string |
||
347 | */ |
||
348 | public function toJson(): string |
||
352 | |||
353 | /** |
||
354 | * Specify data which should be serialized to JSON. |
||
355 | * |
||
356 | * @return array |
||
357 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
358 | */ |
||
359 | public function jsonSerialize() |
||
401 | } |
||
402 |