@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | throw new \Exception("firebase default path must contain /"); |
115 | 115 | } |
116 | 116 | |
117 | - $pathURI = $this->firebaseURI . $this->rootPath . $path . ".json"; |
|
117 | + $pathURI = $this->firebaseURI.$this->rootPath.$path.".json"; |
|
118 | 118 | |
119 | 119 | //set query data |
120 | 120 | $queryData = array(); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $queryData[Option::OPT_PRINT] = $print; |
123 | 123 | } |
124 | 124 | if (!empty($queryData)) { |
125 | - $pathURI = $pathURI . '?' . http_build_query($queryData); |
|
125 | + $pathURI = $pathURI.'?'.http_build_query($queryData); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | $this->refreshToken(); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function getShallow($path = '', $options = array()) |
134 | 134 | { |
135 | 135 | return JCRequest::get( |
136 | - $this->getPathURI($path) . '?' . http_build_query(array( |
|
136 | + $this->getPathURI($path).'?'.http_build_query(array( |
|
137 | 137 | Option::OPT_SHALLOW => 'true' |
138 | 138 | )), |
139 | 139 | $this->addDataToRequest($options), |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | protected function refreshToken() |
232 | 232 | { |
233 | - $this->requestHeader['Authorization'] = 'Bearer ' . $this->auth->getAccessToken(); |
|
233 | + $this->requestHeader['Authorization'] = 'Bearer '.$this->auth->getAccessToken(); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | protected function addDataToPathURI($path = '', $options = array(), $reqType = RequestType::GET) |
@@ -8,10 +8,10 @@ |
||
8 | 8 | |
9 | 9 | namespace JCFirebase; |
10 | 10 | |
11 | -use JC\JCRequest; |
|
12 | -use JC\JCResponse; |
|
13 | 11 | use JCFirebase\Enums\PrintType; |
14 | 12 | use JCFirebase\Enums\RequestType; |
13 | +use JC\JCRequest; |
|
14 | +use JC\JCResponse; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Class JCFirebase |
@@ -155,6 +155,9 @@ |
||
155 | 155 | return $objects; |
156 | 156 | } |
157 | 157 | |
158 | + /** |
|
159 | + * @param FirebaseModel $instance |
|
160 | + */ |
|
158 | 161 | protected static function map($object, $instance) |
159 | 162 | { |
160 | 163 | $mapper = new JsonMapper(); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function save() |
87 | 87 | { |
88 | 88 | if (!empty($this->key)) { |
89 | - $response = $this->firebase->put(self::getNodeName() . '/' . $this->key, array( |
|
89 | + $response = $this->firebase->put(self::getNodeName().'/'.$this->key, array( |
|
90 | 90 | 'data' => $this->getData() |
91 | 91 | )); |
92 | 92 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | { |
106 | 106 | $success = false; |
107 | 107 | if (!empty($this->key)) { |
108 | - $response = $this->firebase->delete(self::getNodeName() . '/' . $this->key); |
|
108 | + $response = $this->firebase->delete(self::getNodeName().'/'.$this->key); |
|
109 | 109 | |
110 | 110 | $success = $response->success(); |
111 | 111 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function findByKey($key, JCFirebase $firebase) |
123 | 123 | { |
124 | - $response = $firebase->get(self::getNodeName() . '/' . $key); |
|
124 | + $response = $firebase->get(self::getNodeName().'/'.$key); |
|
125 | 125 | $object = null; |
126 | 126 | if ($response->success() && $response->body() != 'null') { |
127 | 127 | $object = self::map($response->json(), new static()); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $jsonObject = json_decode($response->body(), true); |
146 | 146 | if ($response->success() && count($jsonObject)) { |
147 | 147 | do { |
148 | - $object = self::map((object)current($jsonObject), new static()); |
|
148 | + $object = self::map((object) current($jsonObject), new static()); |
|
149 | 149 | $object->key = key($jsonObject); |
150 | 150 | $object->firebase = $firebase; |
151 | 151 | $objects[] = $object; |