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 body of the notification. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | public $body; |
||
20 | |||
21 | /** |
||
22 | * The badge of the notification. |
||
23 | * |
||
24 | * @var int |
||
25 | */ |
||
26 | public $badge; |
||
27 | |||
28 | /** |
||
29 | * The sound for the notification. |
||
30 | * |
||
31 | * @var string|null |
||
32 | */ |
||
33 | public $sound; |
||
34 | |||
35 | /** |
||
36 | * The category for action button. |
||
37 | * |
||
38 | * @var string|null |
||
39 | * */ |
||
40 | public $category; |
||
41 | |||
42 | /** |
||
43 | * Value indicating incoming resource in the notification. |
||
44 | * |
||
45 | * @var int|null |
||
46 | */ |
||
47 | public $contentAvailable = null; |
||
48 | |||
49 | /** |
||
50 | * Additional data of the notification. |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | public $custom = []; |
||
55 | |||
56 | /** |
||
57 | * APN Environment |
||
58 | * |
||
59 | * @var int |
||
60 | */ |
||
61 | public $environment = null; |
||
62 | |||
63 | /** |
||
64 | 1 | * APN Certificate path |
|
65 | * |
||
66 | 1 | * @var string |
|
67 | */ |
||
68 | public $certificate = ''; |
||
69 | |||
70 | /** |
||
71 | * APN Certificate Passphrase |
||
72 | * |
||
73 | * @var string |
||
74 | */ |
||
75 | 13 | public $passphrase = ''; |
|
76 | |||
77 | 13 | /** |
|
78 | 13 | * @param string|null $title |
|
79 | 13 | * @param string|null $body |
|
80 | 13 | * @param array $custom |
|
81 | 13 | * @param null|int $badge |
|
82 | * |
||
83 | * @return static |
||
84 | */ |
||
85 | public static function create($title = null, $body = null, $custom = [], $badge = null) |
||
89 | |||
90 | 1 | /** |
|
91 | * @param string|null $title |
||
92 | 1 | * @param string|null $body |
|
93 | * @param array $custom |
||
94 | 1 | * @param null|int $badge |
|
95 | */ |
||
96 | public function __construct($title = null, $body = null, $custom = [], $badge = null) |
||
103 | |||
104 | 1 | /** |
|
105 | * Set the alert title of the notification. |
||
106 | 1 | * |
|
107 | * @param string $title |
||
108 | 1 | * |
|
109 | * @return $this |
||
110 | */ |
||
111 | public function title($title) |
||
117 | |||
118 | 1 | /** |
|
119 | * Set the alert message of the notification. |
||
120 | 1 | * |
|
121 | * @param string $body |
||
122 | 1 | * |
|
123 | * @return $this |
||
124 | */ |
||
125 | public function body($body) |
||
131 | |||
132 | 2 | /** |
|
133 | * Set the badge of the notification. |
||
134 | 2 | * |
|
135 | * @param int $badge |
||
136 | 2 | * |
|
137 | * @return $this |
||
138 | */ |
||
139 | public function badge($badge) |
||
145 | |||
146 | 1 | /** |
|
147 | * Set the sound for the notification. |
||
148 | 1 | * |
|
149 | * @param string|null $sound |
||
150 | 1 | * |
|
151 | * @return $this |
||
152 | */ |
||
153 | public function sound($sound = 'default') |
||
159 | |||
160 | 1 | /** |
|
161 | * Set category for this notification. |
||
162 | 1 | * |
|
163 | * @param string|null $category |
||
164 | 1 | * |
|
165 | * @return $this |
||
166 | * */ |
||
167 | public function category($category) |
||
173 | |||
174 | /** |
||
175 | 2 | * Set content available value for this notification. |
|
176 | * |
||
177 | 2 | * @param int $value |
|
178 | * |
||
179 | 2 | * @return $this |
|
180 | */ |
||
181 | public function contentAvailable($value = 1) |
||
187 | |||
188 | /** |
||
189 | 1 | * Add custom data to the notification. |
|
190 | * |
||
191 | 1 | * @param string $key |
|
192 | * @param mixed $value |
||
193 | 1 | * |
|
194 | * @return $this |
||
195 | */ |
||
196 | public function custom($key, $value) |
||
202 | |||
203 | /** |
||
204 | 1 | * Override the data of the notification. |
|
205 | * |
||
206 | 1 | * @param array $custom |
|
207 | 1 | * |
|
208 | 1 | * @return $this |
|
209 | */ |
||
210 | public function setCustom($custom) |
||
216 | |||
217 | /** |
||
218 | * Add an action to the notification. |
||
219 | * |
||
220 | * @param string $action |
||
221 | * @param mixed $params |
||
222 | * |
||
223 | * @return $this |
||
224 | */ |
||
225 | public function action($action, $params = null) |
||
232 | |||
233 | /** |
||
234 | * Set the APN Environment |
||
235 | * |
||
236 | * @param int $environment |
||
237 | * |
||
238 | * @return $this |
||
239 | */ |
||
240 | public function environment($environment) { |
||
245 | |||
246 | /** |
||
247 | * Set the APN Certificate path |
||
248 | * |
||
249 | * @param string $certificate |
||
250 | * |
||
251 | * @return $this |
||
252 | */ |
||
253 | public function certificate($certificate) { |
||
258 | |||
259 | /** |
||
260 | * Set the APN Certificate passphrase |
||
261 | * |
||
262 | * @param string $passphrase |
||
263 | * |
||
264 | * @return $this |
||
265 | */ |
||
266 | public function passphrase($passphrase) { |
||
271 | } |
||
272 |