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