Completed
Pull Request — master (#1)
by Artem
03:18
created
src/AuthService.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Commands/SyncUsers.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,11 +66,11 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Concerns/UserHelpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Commands/ManageUsers.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -140,8 +140,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.