@@ -66,11 +66,11 @@ |
||
| 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 | |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | */ |
| 101 | 101 | public static function deleteEmail(string $email, int $index): string |
| 102 | 102 | { |
| 103 | - if(strpos($email, ".{$index}.deleted" !== false)) { |
|
| 103 | + if (strpos($email, ".{$index}.deleted" !== false)) { |
|
| 104 | 104 | return $email; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -140,8 +140,7 @@ discard block |
||
| 140 | 140 | if($users->isEmpty()) { |
| 141 | 141 | $this->info('No users found.'); |
| 142 | 142 | return; |
| 143 | - } |
|
| 144 | - else { |
|
| 143 | + } else { |
|
| 145 | 144 | if(!$this->confirm('Do you want to restore ' . $users->count() . ' user(s)?')) { |
| 146 | 145 | return; |
| 147 | 146 | } |
@@ -152,8 +151,7 @@ discard block |
||
| 152 | 151 | $this->authService->handle('restore', ['user' => $user]); |
| 153 | 152 | |
| 154 | 153 | $this->info('User #' . $user->id . ' (' . $user->email . ') successfully restored.'); |
| 155 | - } |
|
| 156 | - catch(\Exception $e) { |
|
| 154 | + } catch(\Exception $e) { |
|
| 157 | 155 | $this->error('User #' . $user->id . ' (' . $user->email . ') cannot be restored. ' . $e->getMessage()); |
| 158 | 156 | } |
| 159 | 157 | } |
@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | protected function runActionHandler(string $action) |
| 87 | 87 | { |
| 88 | - if(!in_array($action, $this->actions)) { |
|
| 88 | + if (!in_array($action, $this->actions)) { |
|
| 89 | 89 | throw new \InvalidArgumentException("Unknown action `{$action}` passed"); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $actionHandler = 'handle' . Str::studly($action); |
| 93 | 93 | |
| 94 | - if(!method_exists($this, $actionHandler)) { |
|
| 94 | + if (!method_exists($this, $actionHandler)) { |
|
| 95 | 95 | throw new \InvalidArgumentException("Cannot find action handler `{$actionHandler}`"); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $users = $this->retrieveUsers(['id' => $this->ids], true); |
| 140 | 140 | |
| 141 | - if($users->isEmpty()) { |
|
| 141 | + if ($users->isEmpty()) { |
|
| 142 | 142 | $this->info('No users found.'); |
| 143 | 143 | return; |
| 144 | 144 | } |
| 145 | 145 | else { |
| 146 | - if(!$this->confirm('Do you want to restore ' . $users->count() . ' user(s)?')) { |
|
| 146 | + if (!$this->confirm('Do you want to restore ' . $users->count() . ' user(s)?')) { |
|
| 147 | 147 | return; |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $this->info('User #' . $user->id . ' (' . $user->email . ') successfully restored.'); |
| 156 | 156 | } |
| 157 | - catch(\Exception $e) { |
|
| 157 | + catch (\Exception $e) { |
|
| 158 | 158 | $this->error('User #' . $user->id . ' (' . $user->email . ') cannot be restored. ' . $e->getMessage()); |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $query->whereIn($column, $value); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if($onlyTrashed) { |
|
| 181 | + if ($onlyTrashed) { |
|
| 182 | 182 | $query->whereNotNull('deleted_at'); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -23,10 +23,10 @@ |
||
| 23 | 23 | $keys = array_map('strtolower', $keys); |
| 24 | 24 | |
| 25 | 25 | foreach ($input as $key => $value) { |
| 26 | - if(is_array($value)) { |
|
| 26 | + if (is_array($value)) { |
|
| 27 | 27 | $input[$key] = static::replaceValuesByMatchingKeys($value, $keys, $replacement); |
| 28 | 28 | } |
| 29 | - elseif(is_string($key) && in_array(strtolower($key), $keys)) { |
|
| 29 | + elseif (is_string($key) && in_array(strtolower($key), $keys)) { |
|
| 30 | 30 | $input[$key] = $replacement instanceof \Closure |
| 31 | 31 | ? $replacement($key, $value) |
| 32 | 32 | : $replacement; |
@@ -25,8 +25,7 @@ |
||
| 25 | 25 | foreach ($input as $key => $value) { |
| 26 | 26 | if(is_array($value)) { |
| 27 | 27 | $input[$key] = static::replaceValuesByMatchingKeys($value, $keys, $replacement); |
| 28 | - } |
|
| 29 | - elseif(is_string($key) && in_array(strtolower($key), $keys)) { |
|
| 28 | + } elseif(is_string($key) && in_array(strtolower($key), $keys)) { |
|
| 30 | 29 | $input[$key] = $replacement instanceof \Closure |
| 31 | 30 | ? $replacement($key, $value) |
| 32 | 31 | : $replacement; |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | protected function boot() |
| 66 | 66 | { |
| 67 | - if(!$publicKey = $this->credential('public')) { |
|
| 67 | + if (!$publicKey = $this->credential('public')) { |
|
| 68 | 68 | throw new \InvalidArgumentException('Public key must be defined'); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if(!$secretKey = $this->credential('secret')) { |
|
| 71 | + if (!$secretKey = $this->credential('secret')) { |
|
| 72 | 72 | throw new \InvalidArgumentException('Secret key must be defined'); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if(!$this->client) { |
|
| 75 | + if (!$this->client) { |
|
| 76 | 76 | $handler = new \GuzzleHttp\HandlerStack(); |
| 77 | 77 | $handler->setHandler(new \GuzzleHttp\Handler\CurlHandler()); |
| 78 | 78 | $handler->push($this->bearerTokenHeader()); |
@@ -275,11 +275,11 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | public function request(string $name, array $parameters = []): array |
| 277 | 277 | { |
| 278 | - if(!$this->hasRequest($name)) { |
|
| 278 | + if (!$this->hasRequest($name)) { |
|
| 279 | 279 | throw new \InvalidArgumentException("Request `{$name}` is not supported"); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if(!method_exists($this, $name)) { |
|
| 282 | + if (!method_exists($this, $name)) { |
|
| 283 | 283 | throw new \InvalidArgumentException("Request `{$name}` listed but is not implemented"); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | public function success(bool $withStatus = false): bool |
| 313 | 313 | { |
| 314 | - if(!$this->response || $this->response->getStatusCode() !== 200) { |
|
| 314 | + if (!$this->response || $this->response->getStatusCode() !== 200) { |
|
| 315 | 315 | return false; |
| 316 | 316 | } |
| 317 | 317 | |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | $this->log(null, $decoded ?? []); |
| 381 | 381 | |
| 382 | - if($this->success()) { |
|
| 382 | + if ($this->success()) { |
|
| 383 | 383 | return $this->formatted; |
| 384 | 384 | } |
| 385 | 385 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | private function bearerToken() |
| 409 | 409 | { |
| 410 | - if(!$token = app('auth')->token()) { |
|
| 410 | + if (!$token = app('auth')->token()) { |
|
| 411 | 411 | return null; |
| 412 | 412 | } |
| 413 | 413 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | public function bearerTokenHeader(): \Closure |
| 423 | 423 | { |
| 424 | 424 | return function(callable $handler) { |
| 425 | - return function (\Psr\Http\Message\RequestInterface $request, array $options) use ($handler) { |
|
| 425 | + return function(\Psr\Http\Message\RequestInterface $request, array $options) use ($handler) { |
|
| 426 | 426 | $request = $request->withHeader('Authorization', $this->bearerToken()); |
| 427 | 427 | |
| 428 | 428 | return $handler($request, $options); |
@@ -383,7 +383,7 @@ |
||
| 383 | 383 | $this->log(null, $decoded ?? []); |
| 384 | 384 | |
| 385 | 385 | if($this->success()) { |
| 386 | - return $this->formatted; |
|
| 386 | + return $this->formatted; |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | $message = Arr::get($this->formatted, 'message'); |
@@ -29,20 +29,20 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function handle(string $key, array $payload) |
| 31 | 31 | { |
| 32 | - if(!$this->has($key)) { |
|
| 32 | + if (!$this->has($key)) { |
|
| 33 | 33 | throw new WebhookException("Webhook with key \"{$key}\" cannot be found."); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $webhook = $this->instantiate($key); |
| 37 | 37 | |
| 38 | - if(!$webhook->validate($payload)) { |
|
| 38 | + if (!$webhook->validate($payload)) { |
|
| 39 | 39 | throw new WebhookValidationException($webhook->getValidator()); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | try { |
| 43 | 43 | return $webhook->handle($payload); |
| 44 | 44 | } |
| 45 | - catch(\Exception $e) { |
|
| 45 | + catch (\Exception $e) { |
|
| 46 | 46 | throw new WebhookException(get_class($webhook) . ': ' . $e->getMessage()); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -41,8 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | try { |
| 43 | 43 | return $webhook->handle($payload); |
| 44 | - } |
|
| 45 | - catch(\Exception $e) { |
|
| 44 | + } catch(\Exception $e) { |
|
| 46 | 45 | throw new WebhookException(get_class($webhook) . ': ' . $e->getMessage()); |
| 47 | 46 | } |
| 48 | 47 | } |
@@ -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 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | protected function loadConsoleCommands() |
| 66 | 66 | { |
| 67 | - if(!$this->app->runningInConsole()) { |
|
| 67 | + if (!$this->app->runningInConsole()) { |
|
| 68 | 68 | return; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | protected function loadGuards() |
| 87 | 87 | { |
| 88 | 88 | // Skip loading guards if an application running in the console |
| 89 | - if($this->app->runningInConsole()) { |
|
| 89 | + if ($this->app->runningInConsole()) { |
|
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $this->app['auth']->guard('authService') |
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | - if(!$this->enabled()) { |
|
| 97 | + if (!$this->enabled()) { |
|
| 98 | 98 | $this->app['authService']->setFallbackGuard( |
| 99 | 99 | $this->app['auth']->guard('fallback') |
| 100 | 100 | ); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $this->app->singleton(AuthService::class); |
| 126 | 126 | |
| 127 | - $this->app->alias(AuthService::class,'authService'); |
|
| 127 | + $this->app->alias(AuthService::class, 'authService'); |
|
| 128 | 128 | |
| 129 | 129 | $this->app->singleton(Mailer::class); |
| 130 | 130 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | }); |
| 149 | 149 | |
| 150 | 150 | // Register the fallback driver if service is disabled |
| 151 | - if(!$this->app->runningInConsole() && !$this->enabled()) { |
|
| 151 | + if (!$this->app->runningInConsole() && !$this->enabled()) { |
|
| 152 | 152 | $this->app['auth']->shouldUse('fallback'); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -277,7 +277,7 @@ |
||
| 277 | 277 | { |
| 278 | 278 | $stack = HandlerStack::create(); |
| 279 | 279 | |
| 280 | - $stack->push(Middleware::mapRequest(function (RequestInterface $request) { |
|
| 280 | + $stack->push(Middleware::mapRequest(function(RequestInterface $request) { |
|
| 281 | 281 | return $this->request = $request; |
| 282 | 282 | })); |
| 283 | 283 | |