@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | try { |
132 | 132 | $output = $callback(Redis::connection('authService')); |
133 | 133 | } |
134 | - catch(\Exception $e) { |
|
134 | + catch (\Exception $e) { |
|
135 | 135 | \Illuminate\Support\Facades\Log::error($e->getMessage()); |
136 | 136 | \Illuminate\Support\Facades\Log::error($e->getTraceAsString()); |
137 | 137 | |
138 | - if($fallback instanceof \Closure) { |
|
138 | + if ($fallback instanceof \Closure) { |
|
139 | 139 | $output = $fallback($e); |
140 | 140 | } |
141 | 141 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function castValueToString($value) |
154 | 154 | { |
155 | - if(is_bool($value)) { |
|
155 | + if (is_bool($value)) { |
|
156 | 156 | return $value ? 'true' : 'false'; |
157 | 157 | } |
158 | 158 | |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | */ |
169 | 169 | protected function castValueFromString($value) |
170 | 170 | { |
171 | - if($value === 'true' || $value === 'false') { |
|
171 | + if ($value === 'true' || $value === 'false') { |
|
172 | 172 | return $value === 'true' ? true : false; |
173 | 173 | } |
174 | 174 | |
175 | - if($value === '') { |
|
175 | + if ($value === '') { |
|
176 | 176 | return null; |
177 | 177 | } |
178 | 178 |
@@ -130,8 +130,7 @@ |
||
130 | 130 | { |
131 | 131 | try { |
132 | 132 | $output = $callback(Redis::connection('authService')); |
133 | - } |
|
134 | - catch(\Exception $e) { |
|
133 | + } catch(\Exception $e) { |
|
135 | 134 | \Illuminate\Support\Facades\Log::error($e->getMessage()); |
136 | 135 | \Illuminate\Support\Facades\Log::error($e->getTraceAsString()); |
137 | 136 |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function login(string $email, string $password, bool $remember = false) |
83 | 83 | { |
84 | - if($this->disabled()) { |
|
84 | + if ($this->disabled()) { |
|
85 | 85 | return $this->handleFallback('login', compact('email', 'password', 'remember')); |
86 | 86 | } |
87 | 87 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function unsafeLogin(string $email, bool $remember = false) |
105 | 105 | { |
106 | - if($this->disabled()) { |
|
106 | + if ($this->disabled()) { |
|
107 | 107 | return $this->handleFallback('unsafeLogin', compact('email', 'remember')); |
108 | 108 | } |
109 | 109 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function logout() |
121 | 121 | { |
122 | - if($this->disabled()) { |
|
122 | + if ($this->disabled()) { |
|
123 | 123 | return $this->handleFallback('logout'); |
124 | 124 | } |
125 | 125 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function register(int $userId, string $name, string $email, string $password, string $country) |
143 | 143 | { |
144 | - if($this->disabled()) { |
|
144 | + if ($this->disabled()) { |
|
145 | 145 | return []; |
146 | 146 | } |
147 | 147 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function forgot(string $email) |
161 | 161 | { |
162 | - if($this->disabled()) { |
|
162 | + if ($this->disabled()) { |
|
163 | 163 | return $this->handleFallback('forgot', compact('email')); |
164 | 164 | } |
165 | 165 | |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function validatePasswordResetToken(string $token, string $email) |
182 | 182 | { |
183 | - if($this->disabled()) { |
|
183 | + if ($this->disabled()) { |
|
184 | 184 | return $this->handleFallback('validateReset', compact('token', 'email')); |
185 | 185 | } |
186 | 186 | |
187 | 187 | $response = $this->client->request('validateReset', compact('token', 'email')); |
188 | 188 | |
189 | - if(!$this->client->success(true)) { |
|
189 | + if (!$this->client->success(true)) { |
|
190 | 190 | return false; |
191 | 191 | } |
192 | 192 | |
@@ -209,13 +209,13 @@ discard block |
||
209 | 209 | { |
210 | 210 | $parameters = compact('token', 'email', 'password', 'confirmation'); |
211 | 211 | |
212 | - if($this->disabled()) { |
|
212 | + if ($this->disabled()) { |
|
213 | 213 | return $this->handleFallback('resetPassword', $parameters); |
214 | 214 | } |
215 | 215 | |
216 | 216 | $response = $this->client->request('reset', $parameters); |
217 | 217 | |
218 | - if(!$this->client->success(true)) { |
|
218 | + if (!$this->client->success(true)) { |
|
219 | 219 | return false; |
220 | 220 | } |
221 | 221 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function update(int $id, ?string $name, ?string $email, ?string $password, ?string $country) |
237 | 237 | { |
238 | - if($this->disabled()) { |
|
238 | + if ($this->disabled()) { |
|
239 | 239 | return false; |
240 | 240 | } |
241 | 241 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | $response = $this->client->request('update', compact('id', 'attributes')); |
245 | 245 | |
246 | - if(!$this->client->success(true)) { |
|
246 | + if (!$this->client->success(true)) { |
|
247 | 247 | return false; |
248 | 248 | } |
249 | 249 | |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function delete(int $id) |
261 | 261 | { |
262 | - if($this->disabled()) { |
|
262 | + if ($this->disabled()) { |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | |
266 | 266 | $response = $this->client->request('delete', compact('id')); |
267 | 267 | |
268 | - if(!$this->client->success(true)) { |
|
268 | + if (!$this->client->success(true)) { |
|
269 | 269 | return false; |
270 | 270 | } |
271 | 271 | |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public function restore(int $id) |
283 | 283 | { |
284 | - if($this->disabled()) { |
|
284 | + if ($this->disabled()) { |
|
285 | 285 | return false; |
286 | 286 | } |
287 | 287 | |
288 | 288 | $response = $this->client->request('restore', compact('id')); |
289 | 289 | |
290 | - if(!$this->client->success(true)) { |
|
290 | + if (!$this->client->success(true)) { |
|
291 | 291 | return false; |
292 | 292 | } |
293 | 293 | |
@@ -301,18 +301,18 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function retrieveByToken() |
303 | 303 | { |
304 | - if($this->disabled()) { |
|
304 | + if ($this->disabled()) { |
|
305 | 305 | return null; |
306 | 306 | } |
307 | 307 | |
308 | 308 | try { |
309 | 309 | $response = $this->client->request('me'); |
310 | 310 | } |
311 | - catch(\Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException $e) { |
|
311 | + catch (\Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException $e) { |
|
312 | 312 | return null; |
313 | 313 | } |
314 | 314 | |
315 | - if(!$this->client->success(true)) { |
|
315 | + if (!$this->client->success(true)) { |
|
316 | 316 | return null; |
317 | 317 | } |
318 | 318 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | { |
347 | 347 | $handler = camel_case(str_replace('.', ' ', $key)); |
348 | 348 | |
349 | - if(!method_exists($this->handlersContainer, $handler)) { |
|
349 | + if (!method_exists($this->handlersContainer, $handler)) { |
|
350 | 350 | throw new \InvalidArgumentException("Handler `{$handler}` cannot be found"); |
351 | 351 | } |
352 | 352 | |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | { |
387 | 387 | $cache = new Cache(); |
388 | 388 | |
389 | - if(!func_num_args()) { |
|
389 | + if (!func_num_args()) { |
|
390 | 390 | return $cache; |
391 | 391 | } |
392 | 392 | |
393 | - if(func_num_args() === 1) { |
|
393 | + if (func_num_args() === 1) { |
|
394 | 394 | return $cache->get($key); |
395 | 395 | } |
396 | 396 | |
@@ -410,11 +410,11 @@ discard block |
||
410 | 410 | { |
411 | 411 | $cache = new Cache(); |
412 | 412 | |
413 | - if(func_num_args() === 1) { |
|
413 | + if (func_num_args() === 1) { |
|
414 | 414 | return $cache->getUserParams($remoteId); |
415 | 415 | } |
416 | 416 | |
417 | - if(func_num_args() === 2) { |
|
417 | + if (func_num_args() === 2) { |
|
418 | 418 | return $cache->getUserParam($remoteId, $key); |
419 | 419 | } |
420 | 420 | |
@@ -438,10 +438,10 @@ discard block |
||
438 | 438 | try { |
439 | 439 | $output = $callback(); |
440 | 440 | } |
441 | - catch(\Exception $e) { |
|
441 | + catch (\Exception $e) { |
|
442 | 442 | DB::rollBack(); |
443 | 443 | |
444 | - if(is_null($fallback)) { |
|
444 | + if (is_null($fallback)) { |
|
445 | 445 | throw $e; |
446 | 446 | } |
447 | 447 |