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 | * Url arguments of the notification. |
||
58 | * |
||
59 | * @var array |
||
60 | */ |
||
61 | public $urlArguments = []; |
||
62 | |||
63 | /** |
||
64 | * Message specific credentials. |
||
65 | * |
||
66 | * @var ApnCredentials |
||
67 | */ |
||
68 | public $credentials = null; |
||
69 | |||
70 | /** |
||
71 | * @param string|null $title |
||
72 | * @param string|null $body |
||
73 | * @param array $custom |
||
74 | * @param null|int $badge |
||
75 | * |
||
76 | * @return static |
||
77 | */ |
||
78 | 1 | public static function create($title = null, $body = null, $custom = [], $badge = null) |
|
82 | |||
83 | /** |
||
84 | * @param string|null $title |
||
85 | * @param string|null $body |
||
86 | * @param array $custom |
||
87 | * @param null|int $badge |
||
88 | */ |
||
89 | 15 | public function __construct($title = null, $body = null, $custom = [], $badge = null) |
|
96 | |||
97 | /** |
||
98 | * Set the alert title of the notification. |
||
99 | * |
||
100 | * @param string $title |
||
101 | * |
||
102 | * @return $this |
||
103 | */ |
||
104 | 1 | public function title($title) |
|
110 | |||
111 | /** |
||
112 | * Set the alert message of the notification. |
||
113 | * |
||
114 | * @param string $body |
||
115 | * |
||
116 | * @return $this |
||
117 | */ |
||
118 | 1 | public function body($body) |
|
124 | |||
125 | /** |
||
126 | * Set the badge of the notification. |
||
127 | * |
||
128 | * @param int $badge |
||
129 | * |
||
130 | * @return $this |
||
131 | */ |
||
132 | 1 | public function badge($badge) |
|
138 | |||
139 | /** |
||
140 | * Set the sound for the notification. |
||
141 | * |
||
142 | * @param string|null $sound |
||
143 | * |
||
144 | * @return $this |
||
145 | */ |
||
146 | 2 | public function sound($sound = 'default') |
|
152 | |||
153 | /** |
||
154 | * Set category for this notification. |
||
155 | * |
||
156 | * @param string|null $category |
||
157 | * |
||
158 | * @return $this |
||
159 | * */ |
||
160 | 1 | public function category($category) |
|
166 | |||
167 | /** |
||
168 | * Set content available value for this notification. |
||
169 | * |
||
170 | * @param int $value |
||
171 | * |
||
172 | * @return $this |
||
173 | */ |
||
174 | 1 | public function contentAvailable($value = 1) |
|
180 | |||
181 | /** |
||
182 | * Add custom data to the notification. |
||
183 | * |
||
184 | * @param string $key |
||
185 | * @param mixed $value |
||
186 | * |
||
187 | * @return $this |
||
188 | */ |
||
189 | 2 | public function custom($key, $value) |
|
195 | |||
196 | /** |
||
197 | * Override the data of the notification. |
||
198 | * |
||
199 | * @param array $custom |
||
200 | * |
||
201 | * @return $this |
||
202 | */ |
||
203 | 1 | public function setCustom($custom) |
|
209 | |||
210 | /** |
||
211 | * Add a url argument to the notification. |
||
212 | * |
||
213 | * @param string $key |
||
214 | * @param mixed $value |
||
215 | * |
||
216 | * @return $this |
||
217 | */ |
||
218 | 1 | public function urlArgument($key, $value) |
|
224 | |||
225 | /** |
||
226 | * Override the data of the notification. |
||
227 | * |
||
228 | * @param array $urlArguments |
||
229 | * |
||
230 | * @return $this |
||
231 | */ |
||
232 | 1 | public function setUrlArguments($urlArguments) |
|
238 | |||
239 | /** |
||
240 | * Add an action to the notification. |
||
241 | * |
||
242 | * @param string $action |
||
243 | * @param mixed $params |
||
244 | * |
||
245 | * @return $this |
||
246 | */ |
||
247 | 1 | public function action($action, $params = null) |
|
254 | |||
255 | /** |
||
256 | * Set message specific credentials. |
||
257 | * |
||
258 | * @param \NotificationChannels\Apn\ApnCredentials $credentials |
||
259 | * @return $this |
||
260 | */ |
||
261 | public function credentials(ApnCredentials $credentials) |
||
267 | } |
||
268 |