1 | <?php |
||
7 | class Devices |
||
8 | { |
||
9 | const DEVICES_LIMIT = 300; |
||
10 | |||
11 | const IOS = 0; |
||
12 | const ANDROID = 1; |
||
13 | const AMAZON = 2; |
||
14 | const WINDOWS_PHONE = 3; |
||
15 | const WINDOWS_PHONE_MPNS = 3; |
||
16 | const CHROME_APP = 4; |
||
17 | const CHROME_WEB = 5; |
||
18 | const WINDOWS_PHONE_WNS = 6; |
||
19 | const SAFARI = 7; |
||
20 | const FIREFOX = 8; |
||
21 | |||
22 | protected $api; |
||
23 | |||
24 | public function __construct(OneSignal $api) |
||
28 | |||
29 | /** |
||
30 | * Get information about device with provided ID. |
||
31 | * |
||
32 | * @param string $id Device ID |
||
33 | * |
||
34 | * @return array |
||
35 | */ |
||
36 | public function getOne($id) |
||
40 | |||
41 | /** |
||
42 | * Get information about all registered devices for your application. |
||
43 | * |
||
44 | * Application auth key must be set. |
||
45 | * |
||
46 | * @param int $limit Results offset (results are sorted by ID) |
||
47 | * @param int $offset How many devices to return (max 300) |
||
48 | * |
||
49 | * @return array |
||
50 | */ |
||
51 | public function getAll($limit = self::DEVICES_LIMIT, $offset = 0) |
||
63 | |||
64 | /** |
||
65 | * Register a device for your application. |
||
66 | * |
||
67 | * @param array $data Device data |
||
68 | * |
||
69 | * @return array |
||
70 | */ |
||
71 | public function add(array $data) |
||
93 | |||
94 | /** |
||
95 | * Update existing registered device for your application with provided data. |
||
96 | * |
||
97 | * @param string $id Device ID |
||
98 | * @param array $data New device data |
||
99 | * |
||
100 | * @return array |
||
101 | */ |
||
102 | public function update($id, array $data) |
||
113 | |||
114 | /** |
||
115 | * Call on new device session in your app. |
||
116 | * |
||
117 | * @param string $id Device ID |
||
118 | * @param array $data Device data |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | public function onSession($id, array $data) |
||
143 | |||
144 | /** |
||
145 | * Track a new purchase. |
||
146 | * |
||
147 | * @param string $id Device ID |
||
148 | * @param array $data Device data |
||
149 | * |
||
150 | * @return array |
||
151 | */ |
||
152 | public function onPurchase($id, array $data) |
||
174 | |||
175 | /** |
||
176 | * Increment the device's total session length. |
||
177 | * |
||
178 | * @param string $id Device ID |
||
179 | * @param array $data Device data |
||
180 | * |
||
181 | * @return array |
||
182 | */ |
||
183 | public function onFocus($id, array $data) |
||
193 | |||
194 | /** |
||
195 | * Export all information about devices in a CSV format for your application. |
||
196 | * |
||
197 | * Application auth key must be set. |
||
198 | * |
||
199 | * @param array $extraFields Additional fields that you wish to include. |
||
200 | * Currently supports: "location", "rooted" |
||
201 | * |
||
202 | * @return array |
||
203 | */ |
||
204 | public function csvExport(array $extraFields = []) |
||
218 | |||
219 | protected function resolve(array $data, callable $callback = null) |
||
265 | } |
||
266 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: