@@ -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 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | protected function loadGuards() |
| 85 | 85 | { |
| 86 | 86 | // Skip loading guards if an application running in the console |
| 87 | - if($this->app->runningInConsole()) { |
|
| 87 | + if ($this->app->runningInConsole()) { |
|
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $this->app['auth']->guard('authService') |
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | - if(!$this->enabled()) { |
|
| 95 | + if (!$this->enabled()) { |
|
| 96 | 96 | $this->app['authService']->setFallbackGuard( |
| 97 | 97 | $this->app['auth']->guard('fallback') |
| 98 | 98 | ); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | }); |
| 147 | 147 | |
| 148 | 148 | // Register the fallback driver if service is disabled |
| 149 | - if(!$this->app->runningInConsole() && !$this->enabled()) { |
|
| 149 | + if (!$this->app->runningInConsole() && !$this->enabled()) { |
|
| 150 | 150 | $this->app['auth']->shouldUse('fallback'); |
| 151 | 151 | } |
| 152 | 152 | } |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $syncer = new Syncer($locals = $this->syncingUsers(), $this->modes()); |
| 45 | 45 | |
| 46 | - if($locals->isEmpty()) { |
|
| 46 | + if ($locals->isEmpty()) { |
|
| 47 | 47 | $this->info('No local users found.'); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if(!$this->confirm('There are ' . $locals->count() . ' local user(s) to export. Continue?', $this->option('no-interaction'))) { |
|
| 50 | + if (!$this->confirm('There are ' . $locals->count() . ' local user(s) to export. Continue?', $this->option('no-interaction'))) { |
|
| 51 | 51 | return; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | private function syncingUsers() |
| 104 | 104 | { |
| 105 | - if(!count($ids = ConsoleHelper::stringToArray($this->option('users')))) { |
|
| 105 | + if (!count($ids = ConsoleHelper::stringToArray($this->option('users')))) { |
|
| 106 | 106 | return Syncer::retrieveLocals(); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | private function filePath() |
| 121 | 121 | { |
| 122 | - if(!$path = $this->option('path')) { |
|
| 122 | + if (!$path = $this->option('path')) { |
|
| 123 | 123 | $path = storage_path('app'); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function handle() |
| 41 | 41 | { |
| 42 | - if(!$key = $this->option('key')) { |
|
| 42 | + if (!$key = $this->option('key')) { |
|
| 43 | 43 | throw new \InvalidArgumentException('Encryption key must be passed.'); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $changes = $syncer->getForeignersCount(); |
| 63 | 63 | |
| 64 | - if(!$this->confirm('Apply ' . $changes . ' changes?', true)) { |
|
| 64 | + if (!$this->confirm('Apply ' . $changes . ' changes?', true)) { |
|
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -99,15 +99,15 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | protected function flushListeners() |
| 101 | 101 | { |
| 102 | - if(class_exists('\App\Http\Models\User')) { |
|
| 102 | + if (class_exists('\App\Http\Models\User')) { |
|
| 103 | 103 | \App\Http\Models\User::flushEventListeners(); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if(class_exists('App\Http\Models\CustomerProfile')) { |
|
| 106 | + if (class_exists('App\Http\Models\CustomerProfile')) { |
|
| 107 | 107 | \App\Http\Models\CustomerProfile::flushEventListeners(); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if(class_exists('App\Modules\Billing\Models\Account::class')) { |
|
| 110 | + if (class_exists('App\Modules\Billing\Models\Account::class')) { |
|
| 111 | 111 | \App\Modules\Billing\Models\Account::flushEventListeners(); |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | protected function runActionHandler(string $action) |
| 86 | 86 | { |
| 87 | - if(!in_array($action, $this->actions)) { |
|
| 87 | + if (!in_array($action, $this->actions)) { |
|
| 88 | 88 | throw new \InvalidArgumentException("Unknown action `{$action}` passed"); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $actionHandler = 'handle' . studly_case($action); |
| 92 | 92 | |
| 93 | - if(!method_exists($this, $actionHandler)) { |
|
| 93 | + if (!method_exists($this, $actionHandler)) { |
|
| 94 | 94 | throw new \InvalidArgumentException("Cannot find action handler `{$actionHandler}`"); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | { |
| 138 | 138 | $users = $this->retrieveUsers(['id' => $this->ids], true); |
| 139 | 139 | |
| 140 | - if($users->isEmpty()) { |
|
| 140 | + if ($users->isEmpty()) { |
|
| 141 | 141 | $this->info('No users found.'); |
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | else { |
| 145 | - if(!$this->confirm('Do you want to restore ' . $users->count() . ' user(s)?')) { |
|
| 145 | + if (!$this->confirm('Do you want to restore ' . $users->count() . ' user(s)?')) { |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $this->info('User #' . $user->id . ' (' . $user->email . ') successfully restored.'); |
| 155 | 155 | } |
| 156 | - catch(\Exception $e) { |
|
| 156 | + catch (\Exception $e) { |
|
| 157 | 157 | $this->error('User #' . $user->id . ' (' . $user->email . ') cannot be restored. ' . $e->getMessage()); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $query->where($column, $value); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if($onlyTrashed) { |
|
| 179 | + if ($onlyTrashed) { |
|
| 180 | 180 | $query->whereNotNull('deleted_at'); |
| 181 | 181 | } |
| 182 | 182 | |
@@ -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 | } |
@@ -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; |