1 | <?php |
||
22 | class JCFirebase |
||
23 | { |
||
24 | public $firebaseURI; |
||
25 | |||
26 | public $rootPath; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | public $requestHeader = array( |
||
32 | 'accept' => 'application/json', |
||
33 | 'contentType' => 'application/json; charset=utf-8', |
||
34 | 'dataType' => 'json' |
||
35 | ); |
||
36 | |||
37 | public $requestOptions = array(); |
||
38 | |||
39 | /** |
||
40 | * @var OAuth |
||
41 | */ |
||
42 | public $auth; |
||
43 | |||
44 | /** |
||
45 | * JCFirebase constructor. |
||
46 | * |
||
47 | * @param $firebaseURI |
||
48 | * @param OAuth $auth |
||
49 | * @param string $rootPath |
||
50 | */ |
||
51 | public function __construct($firebaseURI, OAuth $auth, $rootPath = '/') |
||
57 | |||
58 | |||
59 | /** |
||
60 | * @param $firebaseURI |
||
61 | * @param $jsonString |
||
62 | * @param string $rootPath |
||
63 | * @return JCFirebase |
||
64 | * @throws \Exception |
||
65 | */ |
||
66 | public static function fromJson($firebaseURI, $jsonString, $rootPath = '/') |
||
70 | |||
71 | /** |
||
72 | * @param $firebaseURI |
||
73 | * @param $keyFile |
||
74 | * @param string $rootPath |
||
75 | * |
||
76 | * @return JCFirebase |
||
77 | * @throws \Exception |
||
78 | */ |
||
79 | public static function fromKeyFile($firebaseURI, $keyFile, $rootPath = '/') |
||
83 | |||
84 | public function getPathURI($path = '', $print = '') |
||
121 | |||
122 | public function getShallow($path = '', $options = array()) |
||
132 | |||
133 | /** |
||
134 | * @param string $path |
||
135 | * @param array $options |
||
136 | * |
||
137 | * @return JCResponseInterface |
||
138 | */ |
||
139 | public function get($path = '', $options = array()) |
||
147 | |||
148 | /** |
||
149 | * @param string $path |
||
150 | * @param array $options |
||
151 | * |
||
152 | * @return JCResponseInterface |
||
153 | */ |
||
154 | public function put($path = '', $options = array()) |
||
161 | |||
162 | /** |
||
163 | * @param string $path |
||
164 | * @param array $options |
||
165 | * |
||
166 | * @return JCResponseInterface |
||
167 | */ |
||
168 | public function post($path = '', $options = array()) |
||
176 | |||
177 | /** |
||
178 | * @param string $path |
||
179 | * @param array $options |
||
180 | * |
||
181 | * @return JCResponseInterface |
||
182 | */ |
||
183 | public function patch($path = '', $options = array()) |
||
191 | |||
192 | /** |
||
193 | * @param string $path |
||
194 | * @param array $options |
||
195 | * |
||
196 | * @return JCResponseInterface |
||
197 | */ |
||
198 | public function delete($path = '', $options = array()) |
||
206 | |||
207 | /** |
||
208 | * Function that check firebase authencation |
||
209 | * and configuration valid or not |
||
210 | * |
||
211 | * @return bool |
||
212 | */ |
||
213 | public function isValid() |
||
219 | |||
220 | protected function refreshToken() |
||
224 | |||
225 | protected function addDataToPathURI($path = '', $options = array(), $reqType = RequestType::GET) |
||
234 | |||
235 | protected function addDataToRequest($options = array(), $jsonEncode = false) |
||
249 | } |