1 | <?php |
||
26 | class Firebase extends FirebaseResponce implements FirebaseInterface |
||
27 | { |
||
28 | |||
29 | /** |
||
30 | * Default Timeout |
||
31 | * |
||
32 | * @var integer $timeout |
||
33 | */ |
||
34 | private $timeout = 30; |
||
35 | |||
36 | /** |
||
37 | * Authentication object |
||
38 | * |
||
39 | * @var Config\FirebaseAuth $auth |
||
40 | */ |
||
41 | private $auth; |
||
42 | |||
43 | /** |
||
44 | * Create new Client |
||
45 | * |
||
46 | * @var $client |
||
47 | */ |
||
48 | private $client; |
||
49 | |||
50 | /** |
||
51 | * Responce from firebase |
||
52 | * |
||
53 | * @var mixed $response |
||
54 | */ |
||
55 | private $response; |
||
56 | |||
57 | /** |
||
58 | * Last Auto-Increment saved from post operation |
||
59 | * |
||
60 | * @var string $lastIdStored |
||
61 | */ |
||
62 | protected $lastIdStored = ''; |
||
63 | |||
64 | /** |
||
65 | * Create new Firebase client object |
||
66 | * Remember to install PHP CURL extention |
||
67 | * |
||
68 | * @param Config\FirebaseAuth $auth |
||
69 | */ |
||
70 | public function __construct(FirebaseAuth $auth) |
||
91 | |||
92 | /** |
||
93 | * Init of guzzle |
||
94 | * @return Client |
||
95 | */ |
||
96 | private function guzzeClientInit(): Client |
||
106 | |||
107 | /** |
||
108 | * Return Integer of Timeout |
||
109 | * default 30 setted 10 |
||
110 | * |
||
111 | * @return integer $timeout |
||
112 | */ |
||
113 | public function getTimeout(): int |
||
117 | |||
118 | /** |
||
119 | * Default timeout is 10 seconds |
||
120 | * is is not set switch to 30 |
||
121 | * |
||
122 | * @param integer $timeout |
||
123 | */ |
||
124 | public function setTimeout(int $timeout) |
||
128 | |||
129 | /** |
||
130 | * Return string of LastIdStored generated after post command |
||
131 | * |
||
132 | * @return string $lastIdStored |
||
133 | */ |
||
134 | public function getLastIdStored(): string |
||
138 | |||
139 | /** |
||
140 | * Set string of LastIdStored generated after post command |
||
141 | * |
||
142 | * @param string $lastIdStored |
||
143 | */ |
||
144 | public function setLastIdStored(string $lastIdStored) |
||
148 | |||
149 | /** |
||
150 | * Method for get array headers for Guzzle client |
||
151 | * |
||
152 | * @throws \Exception |
||
153 | * @return array |
||
154 | */ |
||
155 | private function getRequestHeaders(): array |
||
170 | |||
171 | /** |
||
172 | * Returns with the normalized JSON absolute path |
||
173 | * |
||
174 | * @param string $path |
||
175 | * @param array $options |
||
176 | * @return string $path |
||
177 | */ |
||
178 | private function getJsonPath($path, $options = []): string |
||
195 | |||
196 | /** |
||
197 | * DELETE - Removing Data FROM FIREBASE |
||
198 | * |
||
199 | * @param string $path |
||
200 | * @param array $options |
||
201 | * |
||
202 | * {@inheritdoc} |
||
203 | * |
||
204 | * @see \Interfaces\FirebaseInterface::delete() |
||
205 | */ |
||
206 | public function delete(string $path, array $options = []) |
||
210 | |||
211 | /** |
||
212 | * GET - Reading Data FROM FIREBASE |
||
213 | * |
||
214 | * @param string $path |
||
215 | * @param array $options |
||
216 | * |
||
217 | * {@inheritdoc} |
||
218 | * |
||
219 | * @see \Interfaces\FirebaseInterface::get() |
||
220 | */ |
||
221 | public function get(string $path, array $options = []) |
||
225 | |||
226 | /** |
||
227 | * PATCH - Updating Data TO FIREBASE |
||
228 | * |
||
229 | * @param string $path |
||
230 | * @param array $data |
||
231 | * @param array $options |
||
232 | * |
||
233 | * {@inheritdoc} |
||
234 | * |
||
235 | * @see \Interfaces\FirebaseInterface::patch() |
||
236 | */ |
||
237 | public function patch(string $path, array $data, array $options = []) |
||
241 | |||
242 | /** |
||
243 | * POST - Pushing Data TO FIREBASE |
||
244 | * |
||
245 | * @param string $path |
||
246 | * @param array $data |
||
247 | * @param array $options |
||
248 | * |
||
249 | * {@inheritdoc} |
||
250 | * |
||
251 | * @see \Interfaces\FirebaseInterface::post() |
||
252 | */ |
||
253 | public function post(string $path, array $data, array $options = []) |
||
257 | |||
258 | /** |
||
259 | * PUT - Writing Data TO FIREBASE |
||
260 | * |
||
261 | * @param string $path |
||
262 | * @param array $data |
||
263 | * @param array $options |
||
264 | * |
||
265 | * {@inheritdoc} |
||
266 | * |
||
267 | * @see \Interfaces\FirebaseInterface::put() |
||
268 | */ |
||
269 | public function put(string $path, array $data, array $options = []) |
||
273 | |||
274 | /** |
||
275 | * READ RULES - Retrieve firebase rules |
||
276 | * |
||
277 | * @param string $path |
||
278 | */ |
||
279 | public function getRules(string $path) |
||
283 | |||
284 | /** |
||
285 | * WRITE RULES - Retrieve firebase rules |
||
286 | * |
||
287 | * @param string $path |
||
288 | */ |
||
289 | public function writeRules(string $path, array $data) |
||
293 | |||
294 | /** |
||
295 | * Method to send request |
||
296 | * |
||
297 | * @param string $op |
||
298 | * @param string $path |
||
299 | * @param mixed $data |
||
300 | */ |
||
301 | private function writeRequest(string $op, string $path, array $data) |
||
340 | |||
341 | /** |
||
342 | * This function set variables after operation |
||
343 | * |
||
344 | * @param string $operation |
||
345 | * @param mixed $status |
||
346 | */ |
||
347 | private function setDataFromOperation($operation, $status) |
||
354 | |||
355 | /** |
||
356 | * Start stream with server and write log in choised folder |
||
357 | * |
||
358 | * @param string $path |
||
359 | * @param string $folderToStoreLog |
||
360 | * @param integer $requestDelay |
||
361 | * @param string $callback |
||
362 | * @param array $options |
||
363 | * @param boolean $print |
||
364 | * @example $requestDelay = 3000 -> 3 seconds between get request |
||
365 | */ |
||
366 | public function startStream($path, $folderToStoreLog, $callback, $requestDelay = 5000, $options = [], $print = true) |
||
395 | |||
396 | /** |
||
397 | * Print on output datas |
||
398 | * |
||
399 | * @param mixed $eventData |
||
400 | * @param mixed $event |
||
401 | */ |
||
402 | private function printEventData($eventData, $event) |
||
408 | |||
409 | /** |
||
410 | * Format folder name |
||
411 | * |
||
412 | * @param string $folderToStoreLog |
||
413 | * @return string $folderName |
||
414 | */ |
||
415 | private function formatFolderName(string $folderToStoreLog): string |
||
424 | |||
425 | /** |
||
426 | * This method return the responce from firebase |
||
427 | * |
||
428 | * @example set and validate data passed |
||
429 | */ |
||
430 | private function makeResponce() |
||
453 | |||
454 | /** |
||
455 | * Remove object from memory |
||
456 | */ |
||
457 | public function __destruct() |
||
461 | |||
462 | public function getFirebaseData():array |
||
466 | |||
467 | public function getOperation(): string |
||
471 | |||
472 | public function getStatus(): int |
||
476 | } |
||
477 |
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..