@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | |
67 | 67 | $syncer = new Syncer($locals = $this->syncingUsers(), $this->modes()); |
68 | 68 | |
69 | - if($locals->isEmpty()) { |
|
69 | + if ($locals->isEmpty()) { |
|
70 | 70 | $this->info('No local users found.'); |
71 | 71 | } |
72 | 72 | |
73 | - if(!$this->confirm('There are ' . $locals->count() . ' local user(s) to sync. Continue?', $this->option('no-interaction'))) { |
|
73 | + if (!$this->confirm('There are ' . $locals->count() . ' local user(s) to sync. Continue?', $this->option('no-interaction'))) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | */ |
126 | 126 | private function syncingUsers() |
127 | 127 | { |
128 | - if(!$this->hasMode(Syncer::MODE_USERS)) { |
|
128 | + if (!$this->hasMode(Syncer::MODE_USERS)) { |
|
129 | 129 | return Syncer::retrieveLocals(); |
130 | 130 | } |
131 | 131 | |
132 | - if(!count($ids = ConsoleHelper::stringToArray($this->option('users')))) { |
|
132 | + if (!count($ids = ConsoleHelper::stringToArray($this->option('users')))) { |
|
133 | 133 | throw new \InvalidArgumentException('No users passed'); |
134 | 134 | } |
135 | 135 |
@@ -353,7 +353,7 @@ |
||
353 | 353 | \Illuminate\Support\Facades\Log::debug(null, $decoded ?? []); |
354 | 354 | |
355 | 355 | if($this->success()) { |
356 | - return $this->formatted; |
|
356 | + return $this->formatted; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | $message = array_get($this->formatted, 'message'); |
@@ -61,15 +61,15 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function boot() |
63 | 63 | { |
64 | - if(!$publicKey = $this->credential('public')) { |
|
64 | + if (!$publicKey = $this->credential('public')) { |
|
65 | 65 | throw new \InvalidArgumentException('Public key must be defined'); |
66 | 66 | } |
67 | 67 | |
68 | - if(!$secretKey = $this->credential('secret')) { |
|
68 | + if (!$secretKey = $this->credential('secret')) { |
|
69 | 69 | throw new \InvalidArgumentException('Secret key must be defined'); |
70 | 70 | } |
71 | 71 | |
72 | - if(!$this->client) { |
|
72 | + if (!$this->client) { |
|
73 | 73 | $handler = new \GuzzleHttp\HandlerStack(); |
74 | 74 | $handler->setHandler(new \GuzzleHttp\Handler\CurlHandler()); |
75 | 75 | $handler->push($this->bearerTokenHeader()); |
@@ -248,11 +248,11 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function request(string $name, array $parameters = []): array |
250 | 250 | { |
251 | - if(!$this->hasRequest($name)) { |
|
251 | + if (!$this->hasRequest($name)) { |
|
252 | 252 | throw new \InvalidArgumentException("Request `{$name}` is not supported"); |
253 | 253 | } |
254 | 254 | |
255 | - if(!method_exists($this, $name)) { |
|
255 | + if (!method_exists($this, $name)) { |
|
256 | 256 | throw new \InvalidArgumentException("Request `{$name}` listed but is not implemented"); |
257 | 257 | } |
258 | 258 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function success(bool $withStatus = false): bool |
286 | 286 | { |
287 | - if(!$this->response || $this->response->getStatusCode() !== 200) { |
|
287 | + if (!$this->response || $this->response->getStatusCode() !== 200) { |
|
288 | 288 | return false; |
289 | 289 | } |
290 | 290 | |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | \Illuminate\Support\Facades\Log::debug(null, $decoded ?? []); |
354 | 354 | |
355 | - if($this->success()) { |
|
355 | + if ($this->success()) { |
|
356 | 356 | return $this->formatted; |
357 | 357 | } |
358 | 358 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | private function bearerToken() |
382 | 382 | { |
383 | - if(!$token = app('auth')->token()) { |
|
383 | + if (!$token = app('auth')->token()) { |
|
384 | 384 | return null; |
385 | 385 | } |
386 | 386 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | public function bearerTokenHeader(): \Closure |
396 | 396 | { |
397 | 397 | return function(callable $handler) { |
398 | - return function (\Psr\Http\Message\RequestInterface $request, array $options) use ($handler) { |
|
398 | + return function(\Psr\Http\Message\RequestInterface $request, array $options) use ($handler) { |
|
399 | 399 | $request = $request->withHeader('Authorization', $this->bearerToken()); |
400 | 400 | |
401 | 401 | return $handler($request, $options); |
@@ -22,20 +22,20 @@ |
||
22 | 22 | */ |
23 | 23 | public function handle(string $key, array $payload) |
24 | 24 | { |
25 | - if(!$this->has($key)) { |
|
25 | + if (!$this->has($key)) { |
|
26 | 26 | throw new WebhookException("Webhook with key \"{$key}\" cannot be found."); |
27 | 27 | } |
28 | 28 | |
29 | 29 | $webhook = $this->instantiate($key, $payload); |
30 | 30 | |
31 | - if(!$webhook->validate()) { |
|
31 | + if (!$webhook->validate()) { |
|
32 | 32 | throw new WebhookValidationException($webhook->getValidator()); |
33 | 33 | } |
34 | 34 | |
35 | 35 | try { |
36 | 36 | $webhook->handle(); |
37 | 37 | } |
38 | - catch(\Exception $e) { |
|
38 | + catch (\Exception $e) { |
|
39 | 39 | throw new WebhookException(get_class($webhook) . ': ' . $e->getMessage()); |
40 | 40 | } |
41 | 41 | } |
@@ -34,8 +34,7 @@ |
||
34 | 34 | |
35 | 35 | try { |
36 | 36 | $webhook->handle(); |
37 | - } |
|
38 | - catch(\Exception $e) { |
|
37 | + } catch(\Exception $e) { |
|
39 | 38 | throw new WebhookException(get_class($webhook) . ': ' . $e->getMessage()); |
40 | 39 | } |
41 | 40 | } |
@@ -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 | |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function retrieveByToken() |
259 | 259 | { |
260 | - if($this->disabled()) { |
|
260 | + if ($this->disabled()) { |
|
261 | 261 | return null; |
262 | 262 | } |
263 | 263 | |
264 | 264 | try { |
265 | 265 | $response = $this->client->request('me'); |
266 | 266 | } |
267 | - catch(\Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException $e) { |
|
267 | + catch (\Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException $e) { |
|
268 | 268 | return null; |
269 | 269 | } |
270 | 270 | |
271 | - if(!$this->client->success(true)) { |
|
271 | + if (!$this->client->success(true)) { |
|
272 | 272 | return null; |
273 | 273 | } |
274 | 274 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | { |
303 | 303 | $handler = camel_case(str_replace('.', ' ', $key)); |
304 | 304 | |
305 | - if(!method_exists($this->handlersContainer, $handler)) { |
|
305 | + if (!method_exists($this->handlersContainer, $handler)) { |
|
306 | 306 | throw new \InvalidArgumentException("Handler `{$handler}` cannot be found"); |
307 | 307 | } |
308 | 308 | |
@@ -347,10 +347,10 @@ discard block |
||
347 | 347 | try { |
348 | 348 | $output = $callback(); |
349 | 349 | } |
350 | - catch(\Exception $e) { |
|
350 | + catch (\Exception $e) { |
|
351 | 351 | DB::rollBack(); |
352 | 352 | |
353 | - if(is_null($fallback)) { |
|
353 | + if (is_null($fallback)) { |
|
354 | 354 | throw $e; |
355 | 355 | } |
356 | 356 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public static function stringToArray(string $string = null, string $valueDelimiter = ':', string $itemDelimiter = ',') |
24 | 24 | { |
25 | - if(is_null($string)) { |
|
25 | + if (is_null($string)) { |
|
26 | 26 | return []; |
27 | 27 | } |
28 | 28 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $key = array_get($item, 0); |
36 | 36 | $value = array_get($item, 1); |
37 | 37 | |
38 | - if(is_null($value)) { |
|
38 | + if (is_null($value)) { |
|
39 | 39 | $value = $key; |
40 | 40 | $key = $index; |
41 | 41 | } |