@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | { |
83 | 83 | $this->client->request('login', compact('email', 'password', 'remember')); |
84 | 84 | |
85 | - if(!$this->client->success()) { |
|
85 | + if (!$this->client->success()) { |
|
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | |
89 | - if(!$this->token = $this->client->getToken()) { |
|
89 | + if (!$this->token = $this->client->getToken()) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | { |
114 | 114 | $this->client->request('unsafeLogin', compact('email', 'remember')); |
115 | 115 | |
116 | - if(!$this->client->success()) { |
|
116 | + if (!$this->client->success()) { |
|
117 | 117 | return false; |
118 | 118 | } |
119 | 119 | |
120 | - if(!$this->token = $this->client->getToken()) { |
|
120 | + if (!$this->token = $this->client->getToken()) { |
|
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | // If we've already retrieved the user for the current request we can just |
137 | 137 | // return it back immediately. We do not want to fetch the user data on |
138 | 138 | // every call to this method because that would be tremendously slow. |
139 | - if (! is_null($this->user)) { |
|
139 | + if (!is_null($this->user)) { |
|
140 | 140 | return $this->user; |
141 | 141 | } |
142 | 142 | |
143 | 143 | $user = null; |
144 | 144 | |
145 | - if($token = $this->token()) { |
|
145 | + if ($token = $this->token()) { |
|
146 | 146 | $user = $this->retrieveUserFromToken($token); |
147 | 147 | } |
148 | 148 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function token() |
158 | 158 | { |
159 | - if($this->token) { |
|
159 | + if ($this->token) { |
|
160 | 160 | return $this->token; |
161 | 161 | } |
162 | 162 | |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | { |
206 | 206 | $data = (array) \Firebase\JWT\JWT::decode($token, env('JWT_SECRET'), ['HS256']); |
207 | 207 | } |
208 | - catch(\RuntimeException $e) { |
|
208 | + catch (\RuntimeException $e) { |
|
209 | 209 | $this->logout(); |
210 | 210 | |
211 | 211 | return null; |
212 | 212 | } |
213 | 213 | |
214 | - if(!$userId = array_get($data, 'userId')) { |
|
214 | + if (!$userId = array_get($data, 'userId')) { |
|
215 | 215 | return null; |
216 | 216 | } |
217 | 217 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | $handler = 'action' . studly_case($action); |
30 | 30 | |
31 | - if(!method_exists($this, $handler)) { |
|
31 | + if (!method_exists($this, $handler)) { |
|
32 | 32 | throw new \Slides\Connector\Auth\Exceptions\SyncException("User action handler {$handler} cannot be found."); |
33 | 33 | } |
34 | 34 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | protected function actionCreate(RemoteUser $remote) |
46 | 46 | { |
47 | 47 | // If a user with the same email was found, we need to skip the process |
48 | - if(Auth::getProvider()->retrieveByCredentials(['email' => strtolower($remote->getEmail())])) { |
|
48 | + if (Auth::getProvider()->retrieveByCredentials(['email' => strtolower($remote->getEmail())])) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | protected function actionUpdate(RemoteUser $remote) |
65 | 65 | { |
66 | 66 | // If a user with the same email cannot be found, we should skip the process |
67 | - if(!$local = Auth::getProvider()->retrieveByCredentials(['email' => $remote->getEmail()])) { |
|
67 | + if (!$local = Auth::getProvider()->retrieveByCredentials(['email' => $remote->getEmail()])) { |
|
68 | 68 | return; |
69 | 69 | } |
70 | 70 | |
71 | 71 | // If a local user was updated later than remote one, we should skip the process |
72 | 72 | // Since we have a latest one |
73 | - if($this->localNewerThanRemote($local, $remote)) { |
|
73 | + if ($this->localNewerThanRemote($local, $remote)) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
77 | 77 | // If "password" mode is not enabled, we cannot update local passwords, so we simply resetting it |
78 | - if(!$this->hasMode(static::MODE_PASSWORDS)) { |
|
78 | + if (!$this->hasMode(static::MODE_PASSWORDS)) { |
|
79 | 79 | $remote->resetPassword(); |
80 | 80 | } |
81 | 81 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function actionDelete(RemoteUser $remote) |
98 | 98 | { |
99 | - if(!$local = Auth::getProvider()->retrieveByCredentials(['email' => $remote->getEmail()])) { |
|
99 | + if (!$local = Auth::getProvider()->retrieveByCredentials(['email' => $remote->getEmail()])) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | */ |
116 | 116 | private function localNewerThanRemote(LocalUser $local, RemoteUser $remote) |
117 | 117 | { |
118 | - if(!$local->retrieveRemoteId()) { |
|
118 | + if (!$local->retrieveRemoteId()) { |
|
119 | 119 | return false; |
120 | 120 | } |
121 | 121 | |
122 | - if(!$remoteUpdated = $remote->getUpdated()) { |
|
122 | + if (!$remoteUpdated = $remote->getUpdated()) { |
|
123 | 123 | return false; |
124 | 124 | } |
125 | 125 | |
126 | - if(!$localUpdate = $local->retrieveUpdatedAt()) { |
|
126 | + if (!$localUpdate = $local->retrieveUpdatedAt()) { |
|
127 | 127 | return false; |
128 | 128 | } |
129 | 129 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $difference = $this->parseDump($path, $sharedKey, $importModes); |
33 | 33 | |
34 | - $foreigners = array_map(function (array $user) { |
|
34 | + $foreigners = array_map(function(array $user) { |
|
35 | 35 | return $this->createRemoteUserFromResponse($user); |
36 | 36 | }, $difference); |
37 | 37 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | private function parseDump(string $filename, string $sharedKey, bool $importModes): array |
56 | 56 | { |
57 | - if(!file_exists($filename)) { |
|
57 | + if (!file_exists($filename)) { |
|
58 | 58 | throw new \InvalidArgumentException($filename . ' cannot be found'); |
59 | 59 | } |
60 | 60 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // Then delete from a dump so we can proceed with decryption |
67 | 67 | $this->extractHeaders($payload); |
68 | 68 | |
69 | - if($importModes) { |
|
69 | + if ($importModes) { |
|
70 | 70 | $this->modes = array_get($this->importHeaders, 'modes', []); |
71 | 71 | } |
72 | 72 |
@@ -54,7 +54,7 @@ |
||
54 | 54 | */ |
55 | 55 | public function getEncryptionKey() |
56 | 56 | { |
57 | - if(!$this->encryptionKey) { |
|
57 | + if (!$this->encryptionKey) { |
|
58 | 58 | return null; |
59 | 59 | } |
60 | 60 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected function parseResponse(array $response) |
159 | 159 | { |
160 | - $foreigners = array_map(function (array $user) { |
|
160 | + $foreigners = array_map(function(array $user) { |
|
161 | 161 | return $this->createRemoteUserFromResponse($user); |
162 | 162 | }, array_get($response, 'difference')); |
163 | 163 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $action = $foreigner->getRemoteAction() |
198 | 198 | ); |
199 | 199 | } |
200 | - catch(\Slides\Connector\Auth\Exceptions\SyncException $e) { |
|
200 | + catch (\Slides\Connector\Auth\Exceptions\SyncException $e) { |
|
201 | 201 | \Illuminate\Support\Facades\Log::error( |
202 | 202 | "Cannot $action the user {$foreigner->getEmail()}: " . $e->getMessage() |
203 | 203 | ); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | { |
359 | 359 | $output[] = $message; |
360 | 360 | |
361 | - if($this->outputCallback instanceof \Closure) { |
|
361 | + if ($this->outputCallback instanceof \Closure) { |
|
362 | 362 | call_user_func($this->outputCallback, $message); |
363 | 363 | } |
364 | 364 | } |
@@ -196,8 +196,7 @@ |
||
196 | 196 | $foreigner, |
197 | 197 | $action = $foreigner->getRemoteAction() |
198 | 198 | ); |
199 | - } |
|
200 | - catch(\Slides\Connector\Auth\Exceptions\SyncException $e) { |
|
199 | + } catch(\Slides\Connector\Auth\Exceptions\SyncException $e) { |
|
201 | 200 | \Illuminate\Support\Facades\Log::error( |
202 | 201 | "Cannot $action the user {$foreigner->getEmail()}: " . $e->getMessage() |
203 | 202 | ); |
@@ -2,6 +2,6 @@ |
||
2 | 2 | |
3 | 3 | use Illuminate\Support\Facades\Route; |
4 | 4 | |
5 | -Route::group(['namespace' => 'Slides\Connector\Auth\Http\Controllers'], function () { |
|
5 | +Route::group(['namespace' => 'Slides\Connector\Auth\Http\Controllers'], function() { |
|
6 | 6 | Route::post('connector/webhook/{key}', 'WebhookController'); |
7 | 7 | }); |
8 | 8 | \ No newline at end of file |
@@ -64,7 +64,7 @@ |
||
64 | 64 | { |
65 | 65 | $modes = $this->formatModes($modes ?? $this->modes()); |
66 | 66 | |
67 | - if($modes) { |
|
67 | + if ($modes) { |
|
68 | 68 | $this->output->block('Passed modes: ' . $modes, null, 'comment'); |
69 | 69 | } |
70 | 70 | } |
@@ -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 |