1 | <?php |
||
22 | class Payload |
||
23 | { |
||
24 | const PAYLOAD_ROOT_KEY = 'aps'; |
||
25 | const PAYLOAD_ALERT_KEY = 'alert'; |
||
26 | const PAYLOAD_BADGE_KEY = 'badge'; |
||
27 | const PAYLOAD_SOUND_KEY = 'sound'; |
||
28 | const PAYLOAD_CONTENT_AVAILABLE_KEY = 'content-available'; |
||
29 | const PAYLOAD_CATEGORY_KEY = 'category'; |
||
30 | const PAYLOAD_THREAD_ID_KEY = 'thread-id'; |
||
31 | |||
32 | const PAYLOAD_HTTP2_REGULAR_NOTIFICATION_MAXIMUM_SIZE = 4096; |
||
33 | const PAYLOAD_HTTP2_VOIP_NOTIFICATION_MAXIMUM_SIZE = 5120; |
||
34 | const PAYLOAD_BINARY_REGULAR_NOTIFICATION_MAXIMUM_SIZE = 2048; |
||
35 | |||
36 | /** |
||
37 | * The notification settings for your app on the user’s device determine whether an alert or banner is displayed. |
||
38 | * |
||
39 | * @var Alert |
||
40 | */ |
||
41 | private $alert; |
||
42 | |||
43 | /** |
||
44 | * The number to display as the badge of the app icon. |
||
45 | * If this property is absent, the badge is not changed. |
||
46 | * |
||
47 | * @var integer |
||
48 | */ |
||
49 | private $badge; |
||
50 | |||
51 | /** |
||
52 | * The name of a sound file in the app bundle or in the Library/Sounds folder of the app’s data container. |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | private $sound; |
||
57 | |||
58 | /** |
||
59 | * Include this key with a value of true to configure a silent notification. |
||
60 | * |
||
61 | * @var bool |
||
62 | */ |
||
63 | private $contentAvailable; |
||
64 | |||
65 | /** |
||
66 | * Provide this key with a string value that represents the notification’s type. |
||
67 | * |
||
68 | * @var string |
||
69 | */ |
||
70 | private $category; |
||
71 | |||
72 | /** |
||
73 | * Provide this key with a string value that represents the app-specific identifier for grouping notifications. |
||
74 | * |
||
75 | * @var string |
||
76 | */ |
||
77 | private $threadId; |
||
78 | |||
79 | /** |
||
80 | * Payload custom values. |
||
81 | * |
||
82 | * @var array |
||
83 | */ |
||
84 | private $customValues; |
||
85 | |||
86 | protected function __constructor() |
||
89 | |||
90 | /** |
||
91 | * @return Payload |
||
92 | */ |
||
93 | public static function create(): Payload |
||
97 | |||
98 | /** |
||
99 | * Set alert. |
||
100 | * |
||
101 | * @param Alert $alert |
||
102 | * @return Payload |
||
103 | */ |
||
104 | public function setAlert(Alert $alert): Payload |
||
110 | |||
111 | /** |
||
112 | * Get Alert. |
||
113 | * |
||
114 | * @return Alert|null |
||
115 | */ |
||
116 | public function getAlert() |
||
120 | |||
121 | /** |
||
122 | * Set badge. |
||
123 | * |
||
124 | * @param integer $value |
||
125 | * @return Payload |
||
126 | */ |
||
127 | public function setBadge(integer $value): Payload |
||
133 | |||
134 | /** |
||
135 | * Get badge. |
||
136 | * |
||
137 | * @return int|null |
||
138 | */ |
||
139 | public function getBadge() |
||
143 | |||
144 | /** |
||
145 | * Set sound. |
||
146 | * |
||
147 | * @param string $value |
||
148 | * @return Payload |
||
149 | */ |
||
150 | public function setSound(string $value): Payload |
||
156 | |||
157 | /** |
||
158 | * Get sound. |
||
159 | * |
||
160 | * @return string|null |
||
161 | */ |
||
162 | public function getSound() |
||
166 | |||
167 | /** |
||
168 | * Set content availability. |
||
169 | * |
||
170 | * @param bool $value |
||
171 | * @return Payload |
||
172 | */ |
||
173 | public function isContentAvailable(bool $value): Payload |
||
179 | |||
180 | /** |
||
181 | * Set category. |
||
182 | * |
||
183 | * @param string $value |
||
184 | * @return Payload |
||
185 | */ |
||
186 | public function setCategory(string $value): Payload |
||
192 | |||
193 | /** |
||
194 | * Set thread-id. |
||
195 | * |
||
196 | * @param string $value |
||
197 | * @return Payload |
||
198 | */ |
||
199 | public function setThreadId(string $value): Payload |
||
205 | |||
206 | /** |
||
207 | * Set custom value for Payload. |
||
208 | * |
||
209 | * @param string $key |
||
210 | * @param $value |
||
211 | * @return Payload |
||
212 | * @throws InvalidPayloadException |
||
213 | */ |
||
214 | public function setCustomValue(string $key, $value): Payload |
||
224 | |||
225 | /** |
||
226 | * Convert Payload to JSON. |
||
227 | * |
||
228 | * @return string |
||
229 | */ |
||
230 | public function toJson(): string |
||
236 | |||
237 | /** |
||
238 | * Transform Payload object to array. |
||
239 | * |
||
240 | * @return array |
||
241 | */ |
||
242 | private function transform(): array |
||
259 | } |
||
260 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..