@@ -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 | |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | try { |
392 | 392 | $output = $callback(); |
393 | 393 | } |
394 | - catch(\Exception $e) { |
|
394 | + catch (\Exception $e) { |
|
395 | 395 | DB::rollBack(); |
396 | 396 | |
397 | - if(is_null($fallback)) { |
|
397 | + if (is_null($fallback)) { |
|
398 | 398 | throw $e; |
399 | 399 | } |
400 | 400 |
@@ -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 | } |