1 | <?php |
||
21 | class Alert implements \JsonSerializable |
||
22 | { |
||
23 | const ALERT_TITLE_KEY = 'title'; |
||
24 | const ALERT_SUBTITLE = 'subtitle'; |
||
25 | const ALERT_BODY_KEY = 'body'; |
||
26 | const ALERT_TITLE_LOC_KEY = 'loc-key'; |
||
27 | const ALERT_TITLE_LOC_ARGS_KEY = 'loc-args'; |
||
28 | const ALERT_ACTION_LOC_KEY = 'action-loc-key'; |
||
29 | const ALERT_LOC_KEY = 'loc-key'; |
||
30 | const ALERT_LOC_ARGS_KEY = 'loc-args'; |
||
31 | const ALERT_LAUNCH_IMAGE_KEY = 'launch-image'; |
||
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 | protected function __construct() |
||
99 | |||
100 | public static function create() |
||
104 | |||
105 | /** |
||
106 | * Set Alert title. |
||
107 | * |
||
108 | * @param string $value |
||
109 | * @return Alert |
||
110 | */ |
||
111 | public function setTitle(string $value): Alert |
||
117 | |||
118 | /** |
||
119 | * Get Alert title. |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | public function getTitle() |
||
127 | |||
128 | /** |
||
129 | * Set Alert title. |
||
130 | * |
||
131 | * @param string $value |
||
132 | * @return Alert |
||
133 | */ |
||
134 | public function setSubtitle(string $value): Alert |
||
140 | |||
141 | /** |
||
142 | * Get Alert subtitle. |
||
143 | * |
||
144 | * @return string |
||
145 | */ |
||
146 | public function getSubtitle() |
||
150 | |||
151 | /** |
||
152 | * Set Alert body. |
||
153 | * |
||
154 | * @param string $value |
||
155 | * @return Alert |
||
156 | */ |
||
157 | public function setBody(string $value): Alert |
||
163 | |||
164 | /** |
||
165 | * Get Alert body. |
||
166 | * |
||
167 | * @return string |
||
168 | */ |
||
169 | public function getBody() |
||
173 | |||
174 | /** |
||
175 | * Set title-loc-key. |
||
176 | * |
||
177 | * @param string|null $value |
||
178 | * @return Alert |
||
179 | */ |
||
180 | public function setTitleLocKey(string $value = null): Alert |
||
186 | |||
187 | /** |
||
188 | * Get title-loc-key. |
||
189 | * |
||
190 | * @return string |
||
191 | */ |
||
192 | public function getTitleLocKey() |
||
196 | |||
197 | /** |
||
198 | * Set title-loc-args. |
||
199 | * |
||
200 | * @param array|null $value |
||
201 | * @return Alert |
||
202 | */ |
||
203 | public function setTitleLocArgs(array $value = null): Alert |
||
209 | |||
210 | /** |
||
211 | * Get title-loc-args. |
||
212 | * |
||
213 | * @return string[]|null |
||
214 | */ |
||
215 | public function getTitleLocArgs() |
||
219 | |||
220 | /** |
||
221 | * Set action-loc-key. |
||
222 | * |
||
223 | * @param string|null $value |
||
224 | * @return Alert |
||
225 | */ |
||
226 | public function setActionLocKey(string $value = null): Alert |
||
232 | |||
233 | /** |
||
234 | * Get action-loc-key. |
||
235 | * |
||
236 | * @return string|null |
||
237 | */ |
||
238 | public function getActionLocKey() |
||
242 | |||
243 | /** |
||
244 | * Set loc-key. |
||
245 | * |
||
246 | * @param string $value |
||
247 | * @return Alert |
||
248 | */ |
||
249 | public function setLocKey(string $value): Alert |
||
255 | |||
256 | /** |
||
257 | * Get loc-key. |
||
258 | * |
||
259 | * @return string |
||
260 | */ |
||
261 | public function getLocKey() |
||
265 | |||
266 | /** |
||
267 | * Set loc-args. |
||
268 | * |
||
269 | * @param array $value |
||
270 | * @return Alert |
||
271 | */ |
||
272 | public function setLocArgs(array $value): Alert |
||
278 | |||
279 | /** |
||
280 | * Get loc-args. |
||
281 | * |
||
282 | * @return string[] |
||
283 | */ |
||
284 | public function getLocArgs() |
||
288 | |||
289 | /** |
||
290 | * Set launch-image. |
||
291 | * |
||
292 | * @param string $value |
||
293 | * @return $this |
||
294 | */ |
||
295 | public function setLaunchImage(string $value) |
||
301 | |||
302 | /** |
||
303 | * Get launch-image. |
||
304 | * |
||
305 | * @return string |
||
306 | */ |
||
307 | public function getLaunchImage() |
||
311 | |||
312 | /** |
||
313 | * Convert Alert to JSON. |
||
314 | * |
||
315 | * @return string |
||
316 | */ |
||
317 | public function toJson(): string |
||
321 | |||
322 | /** |
||
323 | * Specify data which should be serialized to JSON. |
||
324 | * |
||
325 | * @return array |
||
326 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
327 | */ |
||
328 | public function jsonSerialize() |
||
370 | } |
||
371 |