Completed
Push — hotfix/1.0.5 ( 52954e...39921f )
by Artem
03:00
created
src/TokenGuard.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
     {
81 81
         $this->client->request('login', compact('email', 'password', 'remember'));
82 82
 
83
-        if(!$this->client->success()) {
83
+        if (!$this->client->success()) {
84 84
             return false;
85 85
         }
86 86
 
87
-        if(!$this->token = $this->client->getToken()) {
87
+        if (!$this->token = $this->client->getToken()) {
88 88
             return false;
89 89
         }
90 90
 
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
         // If we've already retrieved the user for the current request we can just
104 104
         // return it back immediately. We do not want to fetch the user data on
105 105
         // every call to this method because that would be tremendously slow.
106
-        if (! is_null($this->user)) {
106
+        if (!is_null($this->user)) {
107 107
             return $this->user;
108 108
         }
109 109
 
110 110
         $user = null;
111 111
 
112
-        if($token = $this->token()) {
112
+        if ($token = $this->token()) {
113 113
             $user = $this->retrieveUserFromToken($token);
114 114
         }
115 115
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function token()
125 125
     {
126
-        if($this->token) {
126
+        if ($this->token) {
127 127
             return $this->token;
128 128
         }
129 129
 
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
         {
173 173
             $data = (array) \Firebase\JWT\JWT::decode($token, env('JWT_SECRET'), ['HS256']);
174 174
         }
175
-        catch(\RuntimeException $e) {
175
+        catch (\RuntimeException $e) {
176 176
             $this->logout();
177 177
 
178 178
             return null;
179 179
         }
180 180
 
181
-        if(!$userId = array_get($data, 'userId')) {
181
+        if (!$userId = array_get($data, 'userId')) {
182 182
             return null;
183 183
         }
184 184
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -171,8 +171,7 @@
 block discarded – undo
171 171
         try
172 172
         {
173 173
             $data = (array) \Firebase\JWT\JWT::decode($token, env('JWT_SECRET'), ['HS256']);
174
-        }
175
-        catch(\RuntimeException $e) {
174
+        } catch(\RuntimeException $e) {
176 175
             $this->logout();
177 176
 
178 177
             return null;
Please login to merge, or discard this patch.
src/Commands/SyncUsers.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             ->newQuery()
65 65
             ->get();
66 66
 
67
-        if(!$this->confirm('There are ' . $users->count() . ' users to sync. Continue?')) {
67
+        if (!$this->confirm('There are ' . $users->count() . ' users to sync. Continue?')) {
68 68
             return;
69 69
         }
70 70
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
         $this->writeStats('Remote affection', array_keys($remoteStats), array_values($remoteStats));
76 76
 
77
-        if(!count($difference)) {
77
+        if (!count($difference)) {
78 78
             $this->info('There are no remote changes!');
79 79
         }
80 80
         else {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         $email = $user->getEmail();
168 168
 
169 169
         // If a user already exists, skip the process
170
-        if($model = Auth::getProvider()->retrieveByCredentials(['email' => $email])) {
170
+        if ($model = Auth::getProvider()->retrieveByCredentials(['email' => $email])) {
171 171
             $this->warn("User with email {$email} already exists, unable to create");
172 172
 
173 173
             return;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $email = $user->getEmail();
189 189
 
190 190
         // If a user doesn't exist, skip the process
191
-        if(!$model = Auth::getProvider()->retrieveByCredentials(['email' => $email])) {
191
+        if (!$model = Auth::getProvider()->retrieveByCredentials(['email' => $email])) {
192 192
             $this->warn("User with email {$email} doesn't exist, unable to update");
193 193
 
194 194
             return;
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         $email = $user->getEmail();
210 210
 
211 211
         // If a user doesn't exist, skip the process
212
-        if(!$model = Auth::getProvider()->retrieveByCredentials(['email' => $email])) {
212
+        if (!$model = Auth::getProvider()->retrieveByCredentials(['email' => $email])) {
213 213
             $this->warn("User with email {$email} doesn't exist, unable to delete");
214 214
 
215 215
             return;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,8 +76,7 @@
 block discarded – undo
76 76
 
77 77
         if(!count($difference)) {
78 78
             $this->info('There are no remote changes!');
79
-        }
80
-        else {
79
+        } else {
81 80
             $this->info('Remote changes detected, applying...');
82 81
         }
83 82
 
Please login to merge, or discard this patch.
src/Client.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -311,7 +311,7 @@
 block discarded – undo
311 311
         $this->formatted = $decoded;
312 312
 
313 313
         if($this->success()) {
314
-           return $this->formatted;
314
+            return $this->formatted;
315 315
         }
316 316
 
317 317
         $message = array_get($this->formatted, 'message');
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
      */
62 62
     protected function boot()
63 63
     {
64
-        if(!$publicKey = $this->credential('public')) {
64
+        if (!$publicKey = $this->credential('public')) {
65 65
             throw new \InvalidArgumentException('Public key must be defined');
66 66
         }
67 67
 
68
-        if(!$secretKey = $this->credential('secret')) {
68
+        if (!$secretKey = $this->credential('secret')) {
69 69
             throw new \InvalidArgumentException('Secret key must be defined');
70 70
         }
71 71
 
72
-        if(!$this->client) {
72
+        if (!$this->client) {
73 73
             $handler = new \GuzzleHttp\HandlerStack();
74 74
             $handler->setHandler(new \GuzzleHttp\Handler\CurlHandler());
75 75
             $handler->push($this->bearerTokenHeader());
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function request(string $name, array $parameters = []): array
214 214
     {
215
-        if(!$this->hasRequest($name)) {
215
+        if (!$this->hasRequest($name)) {
216 216
             throw new \InvalidArgumentException("Request `{$name}` is not supported");
217 217
         }
218 218
 
219
-        if(!method_exists($this, $name)) {
219
+        if (!method_exists($this, $name)) {
220 220
             throw new \InvalidArgumentException("Request `{$name}` listed but isn't implemented");
221 221
         }
222 222
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      */
247 247
     public function success(bool $withStatus = false): bool
248 248
     {
249
-        if(!$this->response || $this->response->getStatusCode() !== 200) {
249
+        if (!$this->response || $this->response->getStatusCode() !== 200) {
250 250
             return false;
251 251
         }
252 252
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 
311 311
         $this->formatted = $decoded;
312 312
 
313
-        if($this->success()) {
313
+        if ($this->success()) {
314 314
            return $this->formatted;
315 315
         }
316 316
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
      */
335 335
     private function bearerToken()
336 336
     {
337
-        if(!$token = app('auth')->token()) {
337
+        if (!$token = app('auth')->token()) {
338 338
             return null;
339 339
         }
340 340
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
     public function bearerTokenHeader(): \Closure
350 350
     {
351 351
         return function(callable $handler) {
352
-            return function (\Psr\Http\Message\RequestInterface $request, array $options) use ($handler) {
352
+            return function(\Psr\Http\Message\RequestInterface $request, array $options) use ($handler) {
353 353
                 $request = $request->withHeader('Authorization', $this->bearerToken());
354 354
 
355 355
                 return $handler($request, $options);
Please login to merge, or discard this patch.
src/AuthService.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function login(string $email, string $password, bool $remember = false)
82 82
     {
83
-        if($this->disabled()) {
83
+        if ($this->disabled()) {
84 84
             return $this->handleFallback('login', compact('email', 'password', 'remember'));
85 85
         }
86 86
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function logout()
98 98
     {
99
-        if($this->disabled()) {
99
+        if ($this->disabled()) {
100 100
             return $this->handleFallback('logout');
101 101
         }
102 102
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function register(int $userId, string $name, string $email, string $password)
119 119
     {
120
-        if($this->disabled()) {
120
+        if ($this->disabled()) {
121 121
             return [];
122 122
         }
123 123
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function forgot(string $email)
137 137
     {
138
-        if($this->disabled()) {
138
+        if ($this->disabled()) {
139 139
             return $this->handleFallback('forgot', compact('email'));
140 140
         }
141 141
 
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function validatePasswordResetToken(string $token, string $email)
158 158
     {
159
-        if($this->disabled()) {
159
+        if ($this->disabled()) {
160 160
             return $this->handleFallback('validateReset', compact('token', 'email'));
161 161
         }
162 162
 
163 163
         $response = $this->client->request('validateReset', compact('token', 'email'));
164 164
 
165
-        if(!$this->client->success(true)) {
165
+        if (!$this->client->success(true)) {
166 166
             return false;
167 167
         }
168 168
 
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
     {
186 186
         $parameters = compact('token', 'email', 'password', 'confirmation');
187 187
 
188
-        if($this->disabled()) {
188
+        if ($this->disabled()) {
189 189
             return $this->handleFallback('resetPassword', $parameters);
190 190
         }
191 191
 
192 192
         $response = $this->client->request('reset', $parameters);
193 193
 
194
-        if(!$this->client->success(true)) {
194
+        if (!$this->client->success(true)) {
195 195
             return false;
196 196
         }
197 197
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     public function update(int $id, ?string $name, ?string $email, ?string $password)
212 212
     {
213
-        if($this->disabled()) {
213
+        if ($this->disabled()) {
214 214
             return false;
215 215
         }
216 216
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
         $response = $this->client->request('update', compact('id', 'attributes'));
220 220
 
221
-        if(!$this->client->success(true)) {
221
+        if (!$this->client->success(true)) {
222 222
             return false;
223 223
         }
224 224
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
     {
253 253
         $handler = camel_case(str_replace('.', ' ', $key));
254 254
 
255
-        if(!method_exists($this->handlersContainer, $handler)) {
255
+        if (!method_exists($this->handlersContainer, $handler)) {
256 256
             throw new \InvalidArgumentException("Handler `{$handler}` cannot be found");
257 257
         }
258 258
 
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
         try {
298 298
             $output = $callback();
299 299
         }
300
-        catch(\Exception $e) {
300
+        catch (\Exception $e) {
301 301
             DB::rollBack();
302 302
 
303
-            if(is_null($fallback)) {
303
+            if (is_null($fallback)) {
304 304
                 throw $e;
305 305
             }
306 306
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -296,8 +296,7 @@
 block discarded – undo
296 296
 
297 297
         try {
298 298
             $output = $callback();
299
-        }
300
-        catch(\Exception $e) {
299
+        } catch(\Exception $e) {
301 300
             DB::rollBack();
302 301
 
303 302
             if(is_null($fallback)) {
Please login to merge, or discard this patch.
src/ServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     protected function loadConsoleCommands()
75 75
     {
76
-        if(!$this->app->runningInConsole()) {
76
+        if (!$this->app->runningInConsole()) {
77 77
             return;
78 78
         }
79 79
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     protected function loadGuards()
92 92
     {
93 93
         // Skip loading guards if an application running in the console
94
-        if($this->app->runningInConsole()) {
94
+        if ($this->app->runningInConsole()) {
95 95
             return;
96 96
         }
97 97
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             $this->app['auth']->guard('authService')
100 100
         );
101 101
 
102
-        if(!$this->enabled()) {
102
+        if (!$this->enabled()) {
103 103
             $this->app['authService']->setFallbackGuard(
104 104
                 $this->app['auth']->guard('fallback')
105 105
             );
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         });
137 137
 
138 138
         // Register the fallback driver if service is disabled
139
-        if(!$this->enabled()) {
139
+        if (!$this->enabled()) {
140 140
             $this->app['auth']->shouldUse('fallback');
141 141
         }
142 142
     }
Please login to merge, or discard this patch.
src/Concerns/ResetsPasswords.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function showResetForm(string $token, string $email)
30 30
     {
31
-        if(!$email = AuthService::validatePasswordResetToken($token, $email)) {
31
+        if (!$email = AuthService::validatePasswordResetToken($token, $email)) {
32 32
             throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException();
33 33
         }
34 34
 
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $this->validate($request, $this->rules(), $this->validationErrorMessages());
50 50
 
51
-        if($response = AuthService::resetPassword(
51
+        if ($response = AuthService::resetPassword(
52 52
             $request->input('token'),
53 53
             $email = $request->input('email'),
54 54
             $password = $request->input('password'),
55 55
             $request->input('password_confirmation')
56 56
         )) {
57
-            if(AuthService::login($email, $password)) {
57
+            if (AuthService::login($email, $password)) {
58 58
                 return $this->sendResetResponse(PasswordBroker::PASSWORD_RESET);
59 59
             }
60 60
         }
Please login to merge, or discard this patch.
src/Exceptions/ValidationException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
         $messages = [];
47 47
 
48 48
         foreach (json_decode($message, true) as $property => $attributeMessages) {
49
-            if(in_array($property, static::$attributeHides)) {
49
+            if (in_array($property, static::$attributeHides)) {
50 50
                 continue;
51 51
             }
52 52
 
Please login to merge, or discard this patch.