@@ -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 |
@@ -80,7 +80,7 @@ discard block |
||
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 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function unsafeLogin(string $email, bool $remember = false) |
104 | 104 | { |
105 | - if($this->disabled()) { |
|
105 | + if ($this->disabled()) { |
|
106 | 106 | return $this->handleFallback('unsafeLogin', compact('email', 'remember')); |
107 | 107 | } |
108 | 108 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function logout() |
120 | 120 | { |
121 | - if($this->disabled()) { |
|
121 | + if ($this->disabled()) { |
|
122 | 122 | return $this->handleFallback('logout'); |
123 | 123 | } |
124 | 124 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function register(int $userId, string $name, string $email, string $password) |
141 | 141 | { |
142 | - if($this->disabled()) { |
|
142 | + if ($this->disabled()) { |
|
143 | 143 | return []; |
144 | 144 | } |
145 | 145 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function forgot(string $email) |
159 | 159 | { |
160 | - if($this->disabled()) { |
|
160 | + if ($this->disabled()) { |
|
161 | 161 | return $this->handleFallback('forgot', compact('email')); |
162 | 162 | } |
163 | 163 | |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function validatePasswordResetToken(string $token, string $email) |
180 | 180 | { |
181 | - if($this->disabled()) { |
|
181 | + if ($this->disabled()) { |
|
182 | 182 | return $this->handleFallback('validateReset', compact('token', 'email')); |
183 | 183 | } |
184 | 184 | |
185 | 185 | $response = $this->client->request('validateReset', compact('token', 'email')); |
186 | 186 | |
187 | - if(!$this->client->success(true)) { |
|
187 | + if (!$this->client->success(true)) { |
|
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | { |
208 | 208 | $parameters = compact('token', 'email', 'password', 'confirmation'); |
209 | 209 | |
210 | - if($this->disabled()) { |
|
210 | + if ($this->disabled()) { |
|
211 | 211 | return $this->handleFallback('resetPassword', $parameters); |
212 | 212 | } |
213 | 213 | |
214 | 214 | $response = $this->client->request('reset', $parameters); |
215 | 215 | |
216 | - if(!$this->client->success(true)) { |
|
216 | + if (!$this->client->success(true)) { |
|
217 | 217 | return false; |
218 | 218 | } |
219 | 219 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function update(int $id, ?string $name, ?string $email, ?string $password) |
234 | 234 | { |
235 | - if($this->disabled()) { |
|
235 | + if ($this->disabled()) { |
|
236 | 236 | return false; |
237 | 237 | } |
238 | 238 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | $response = $this->client->request('update', compact('id', 'attributes')); |
242 | 242 | |
243 | - if(!$this->client->success(true)) { |
|
243 | + if (!$this->client->success(true)) { |
|
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | { |
275 | 275 | $handler = camel_case(str_replace('.', ' ', $key)); |
276 | 276 | |
277 | - if(!method_exists($this->handlersContainer, $handler)) { |
|
277 | + if (!method_exists($this->handlersContainer, $handler)) { |
|
278 | 278 | throw new \InvalidArgumentException("Handler `{$handler}` cannot be found"); |
279 | 279 | } |
280 | 280 | |
@@ -319,10 +319,10 @@ discard block |
||
319 | 319 | try { |
320 | 320 | $output = $callback(); |
321 | 321 | } |
322 | - catch(\Exception $e) { |
|
322 | + catch (\Exception $e) { |
|
323 | 323 | DB::rollBack(); |
324 | 324 | |
325 | - if(is_null($fallback)) { |
|
325 | + if (is_null($fallback)) { |
|
326 | 326 | throw $e; |
327 | 327 | } |
328 | 328 |
@@ -64,7 +64,7 @@ discard block |
||
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 |
||
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 |
||
167 | 167 | $email = $user->getEmail(); |
168 | 168 | |
169 | 169 | // If a user already exists, skip the process |
170 | - if(Auth::getProvider()->retrieveByCredentials(['email' => $email])) { |
|
170 | + if (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 |
||
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 |
||
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; |
@@ -28,7 +28,7 @@ discard block |
||
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 |
||
48 | 48 | { |
49 | 49 | $this->validate($request, $this->rules(), $this->validationErrorMessages()); |
50 | 50 | |
51 | - if(AuthService::resetPassword( |
|
51 | + if (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 | } |