1 | <?php |
||
18 | class Client |
||
19 | { |
||
20 | /** |
||
21 | * Array of notifications. |
||
22 | * |
||
23 | * @var Notification[] |
||
24 | */ |
||
25 | private $notifications = []; |
||
26 | |||
27 | /** |
||
28 | * Authentication provider. |
||
29 | * |
||
30 | * @var AuthProviderInterface |
||
31 | */ |
||
32 | private $authProvider; |
||
33 | |||
34 | /** |
||
35 | * Production or sandbox environment. |
||
36 | * |
||
37 | * @var bool |
||
38 | */ |
||
39 | private $isProductionEnv; |
||
40 | |||
41 | /** |
||
42 | * Number of concurrent requests to multiplex in the same connection. |
||
43 | * |
||
44 | * @var int |
||
45 | */ |
||
46 | private $nbConcurrentRequests = 20; |
||
47 | |||
48 | /** |
||
49 | * Number of maximum concurrent connections established to the APNS servers. |
||
50 | * |
||
51 | * @var int |
||
52 | */ |
||
53 | private $maxConcurrentConnections = 1; |
||
54 | |||
55 | /** |
||
56 | * Flag to know if we should automatically close connections to the APNS servers or keep them alive. |
||
57 | * |
||
58 | * @var bool |
||
59 | */ |
||
60 | private $autoCloseConnections = true; |
||
61 | |||
62 | /** |
||
63 | * Current curl_multi handle instance. |
||
64 | * |
||
65 | * @var resource |
||
66 | */ |
||
67 | private $curlMultiHandle; |
||
68 | |||
69 | /** |
||
70 | * options for curl |
||
71 | * |
||
72 | * @var resource |
||
73 | */ |
||
74 | private $curlOptions = array(); |
||
75 | |||
76 | /** |
||
77 | * Client constructor. |
||
78 | * |
||
79 | * @param AuthProviderInterface $authProvider |
||
80 | * @param bool $isProductionEnv |
||
81 | */ |
||
82 | public function __construct(AuthProviderInterface $authProvider, bool $isProductionEnv = false, array $curlOptions = array()) |
||
88 | |||
89 | /** |
||
90 | * Push notifications to APNs. |
||
91 | * |
||
92 | * @return ApnsResponseInterface[] |
||
93 | */ |
||
94 | public function push(): array |
||
183 | |||
184 | /** |
||
185 | * Prepares a curl handle from a Notification object. |
||
186 | * |
||
187 | * @param Notification $notification |
||
188 | * |
||
189 | * @return resource Curl resource |
||
190 | */ |
||
191 | private function prepareHandle(Notification $notification) |
||
206 | |||
207 | /** |
||
208 | * Add several notifications in queue for sending. |
||
209 | * |
||
210 | * @param Notification[] $notifications |
||
211 | */ |
||
212 | public function addNotifications(array $notifications) |
||
222 | |||
223 | /** |
||
224 | * Add notification in queue for sending. |
||
225 | * |
||
226 | * @param Notification $notification |
||
227 | */ |
||
228 | public function addNotification(Notification $notification) |
||
232 | |||
233 | /** |
||
234 | * Get already added notifications. |
||
235 | * |
||
236 | * @return Notification[] |
||
237 | */ |
||
238 | public function getNotifications(): array |
||
242 | |||
243 | /** |
||
244 | * Close the current curl multi handle. |
||
245 | */ |
||
246 | public function close() |
||
253 | |||
254 | /** |
||
255 | * Set the number of concurrent requests sent through the multiplexed connections. |
||
256 | * |
||
257 | * @param int $nbConcurrentRequests |
||
258 | */ |
||
259 | public function setNbConcurrentRequests($nbConcurrentRequests) |
||
263 | |||
264 | |||
265 | /** |
||
266 | * Set the number of maximum concurrent connections established to the APNS servers. |
||
267 | * |
||
268 | * @param int $maxConcurrentConnections |
||
269 | */ |
||
270 | public function setMaxConcurrentConnections($maxConcurrentConnections) |
||
274 | |||
275 | /** |
||
276 | * Set if the client should automatically close the connections or not. Apple recommends keeping |
||
277 | * connections open if you send more than a few notification per minutes. |
||
278 | * |
||
279 | * @param bool $autoCloseConnections |
||
280 | */ |
||
281 | public function setAutoCloseConnections($autoCloseConnections) |
||
285 | } |
||
286 |
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..