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 = 'loc-key'; |
||
26 | const ALERT_TITLE_LOC_ARGS_KEY = '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 | |||
32 | /** |
||
33 | * A short string describing the purpose of the notification. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | private $title; |
||
38 | |||
39 | /** |
||
40 | * A subtitle. |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | private $subtitle; |
||
45 | |||
46 | /** |
||
47 | * The text of the alert message. |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | private $body; |
||
52 | |||
53 | /** |
||
54 | * The key to a title string in the Localizable.strings file for the current localization. |
||
55 | * |
||
56 | * @var string|null |
||
57 | */ |
||
58 | private $titleLocKey; |
||
59 | |||
60 | /** |
||
61 | * Variable string values to appear in place of the format specifiers in title-loc-key. |
||
62 | * |
||
63 | * @var string[]|null |
||
64 | */ |
||
65 | private $titleLocArgs; |
||
66 | |||
67 | /** |
||
68 | * If a string is specified, the iOS system displays an alert that includes the Close and View buttons. |
||
69 | * |
||
70 | * @var string|null |
||
71 | */ |
||
72 | private $actionLocKey; |
||
73 | |||
74 | /** |
||
75 | * A key to an alert-message string in a Localizable.strings file for the current localization. |
||
76 | * |
||
77 | * @var string |
||
78 | */ |
||
79 | private $locKey; |
||
80 | |||
81 | /** |
||
82 | * Variable string values to appear in place of the format specifiers in loc-key. |
||
83 | * |
||
84 | * @var string[] |
||
85 | */ |
||
86 | private $locArgs; |
||
87 | |||
88 | /** |
||
89 | * The filename of an image file in the app bundle, with or without the filename extension. |
||
90 | * |
||
91 | * @var string |
||
92 | */ |
||
93 | private $launchImage; |
||
94 | |||
95 | protected function __construct() |
||
98 | |||
99 | public static function create() |
||
103 | |||
104 | /** |
||
105 | * Set Alert title. |
||
106 | * |
||
107 | * @param string $value |
||
108 | * @return Alert |
||
109 | */ |
||
110 | public function setTitle(string $value): Alert |
||
116 | |||
117 | /** |
||
118 | * Get Alert title. |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function getTitle() |
||
126 | |||
127 | /** |
||
128 | * Set Alert title. |
||
129 | * |
||
130 | * @param string $value |
||
131 | * @return Alert |
||
132 | */ |
||
133 | public function setSubtitle(string $value): Alert |
||
139 | |||
140 | /** |
||
141 | * Get Alert subtitle. |
||
142 | * |
||
143 | * @return string |
||
144 | */ |
||
145 | public function getSubtitle() |
||
149 | |||
150 | /** |
||
151 | * Set Alert body. |
||
152 | * |
||
153 | * @param string $value |
||
154 | * @return Alert |
||
155 | */ |
||
156 | public function setBody(string $value): Alert |
||
162 | |||
163 | /** |
||
164 | * Get Alert body. |
||
165 | * |
||
166 | * @return string |
||
167 | */ |
||
168 | public function getBody() |
||
172 | |||
173 | /** |
||
174 | * Set title-loc-key. |
||
175 | * |
||
176 | * @param string|null $value |
||
177 | * @return Alert |
||
178 | */ |
||
179 | public function setTitleLocKey(string $value = null): Alert |
||
185 | |||
186 | /** |
||
187 | * Get title-loc-key. |
||
188 | * |
||
189 | * @return string |
||
190 | */ |
||
191 | public function getTitleLocKey() |
||
195 | |||
196 | /** |
||
197 | * Set title-loc-args. |
||
198 | * |
||
199 | * @param array|null $value |
||
200 | * @return Alert |
||
201 | */ |
||
202 | public function setTitleLocArgs(array $value = null): Alert |
||
208 | |||
209 | /** |
||
210 | * Get title-loc-args. |
||
211 | * |
||
212 | * @return string[]|null |
||
213 | */ |
||
214 | public function getTitleLocArgs() |
||
218 | |||
219 | /** |
||
220 | * Set action-loc-key. |
||
221 | * |
||
222 | * @param string|null $value |
||
223 | * @return Alert |
||
224 | */ |
||
225 | public function setActionLocKey(string $value = null): Alert |
||
231 | |||
232 | /** |
||
233 | * Get action-loc-key. |
||
234 | * |
||
235 | * @return string|null |
||
236 | */ |
||
237 | public function getActionLocKey() |
||
241 | |||
242 | /** |
||
243 | * Set loc-key. |
||
244 | * |
||
245 | * @param string $value |
||
246 | * @return Alert |
||
247 | */ |
||
248 | public function setLocKey(string $value): Alert |
||
254 | |||
255 | /** |
||
256 | * Get loc-key. |
||
257 | * |
||
258 | * @return string |
||
259 | */ |
||
260 | public function getLocKey() |
||
264 | |||
265 | /** |
||
266 | * Set loc-args. |
||
267 | * |
||
268 | * @param array $value |
||
269 | * @return Alert |
||
270 | */ |
||
271 | public function setLocArgs(array $value): Alert |
||
277 | |||
278 | /** |
||
279 | * Get loc-args. |
||
280 | * |
||
281 | * @return string[] |
||
282 | */ |
||
283 | public function getLocArgs() |
||
287 | |||
288 | /** |
||
289 | * Set launch-image. |
||
290 | * |
||
291 | * @param string $value |
||
292 | * @return $this |
||
293 | */ |
||
294 | public function setLaunchImage(string $value) |
||
300 | |||
301 | /** |
||
302 | * Get launch-image. |
||
303 | * |
||
304 | * @return string |
||
305 | */ |
||
306 | public function getLaunchImage() |
||
310 | |||
311 | /** |
||
312 | * Convert Alert to JSON. |
||
313 | * |
||
314 | * @return string |
||
315 | */ |
||
316 | public function toJson(): string |
||
320 | |||
321 | /** |
||
322 | * Specify data which should be serialized to JSON. |
||
323 | * |
||
324 | * @return array |
||
325 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
326 | */ |
||
327 | public function jsonSerialize() |
||
365 | } |
||
366 |