Passed
Pull Request — master (#14)
by ARCANEDEV
08:52
created
src/Auth/Repositories/RolesRepository.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function createOne(array $attributes): Role
143 143
     {
144
-        return tap($this->create($attributes), function (Role $role) use ($attributes) {
144
+        return tap($this->create($attributes), function(Role $role) use ($attributes) {
145 145
             $this->syncPermissionsByUuids($role, $attributes['permissions'] ?: []);
146 146
         });
147 147
     }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
         if ($admin->isSuperAdmin())
311 311
             return $roles;
312 312
 
313
-        return $roles->reject(function (Role $role) {
313
+        return $roles->reject(function(Role $role) {
314 314
             return $role->isAdministrator();
315 315
         });
316 316
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -186,8 +186,9 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public function syncPermissionsByIds(Role $role, array $ids): array
188 188
     {
189
-        if (empty($ids))
190
-            return [];
189
+        if (empty($ids)) {
190
+                    return [];
191
+        }
191 192
 
192 193
         event(new SyncingPermissions($role, $ids));
193 194
         $synced = $role->permissions()->sync($ids);
@@ -307,8 +308,9 @@  discard block
 block discarded – undo
307 308
     {
308 309
         $roles = $this->get();
309 310
 
310
-        if ($admin->isSuperAdmin())
311
-            return $roles;
311
+        if ($admin->isSuperAdmin()) {
312
+                    return $roles;
313
+        }
312 314
 
313 315
         return $roles->reject(function (Role $role) {
314 316
             return $role->isAdministrator();
Please login to merge, or discard this patch.
src/Auth/Repositories/SocialiteUsersRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@
 block discarded – undo
111 111
             'password'    => null,
112 112
         ];
113 113
 
114
-        return tap($this->getUsersRepository()->createOne($attributes), function ($user) {
114
+        return tap($this->getUsersRepository()->createOne($attributes), function($user) {
115 115
             event(new UserRegistered($user));
116 116
         });
117 117
     }
Please login to merge, or discard this patch.
src/Auth/Repositories/AdministratorsRepository.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function onlyTrashed(bool $condition = true)
78 78
     {
79
-        return $this->when($condition, function (Builder $q) {
79
+        return $this->when($condition, function(Builder $q) {
80 80
             return $q->onlyTrashed();
81 81
         });
82 82
     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $attributes['password'] = $attributes['password'] ?? Str::random(8);
114 114
 
115
-        return tap($this->model()->fill($attributes), function (Administrator $administrator) use ($attributes) {
115
+        return tap($this->model()->fill($attributes), function(Administrator $administrator) use ($attributes) {
116 116
             $administrator->forceFill([
117 117
                 'activated_at' => $attributes['activated_at'] ?? now(), // TODO: Add a setting to change this
118 118
             ]);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     {
133 133
         $roles = $attributes['roles'];
134 134
 
135
-        return tap($this->createOne($attributes), function ($administrator) use ($roles) {
135
+        return tap($this->createOne($attributes), function($administrator) use ($roles) {
136 136
             $this->syncRolesByUuids($administrator, $roles);
137 137
         });
138 138
     }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $roles = $attributes['roles'];
167 167
 
168
-        return tap($this->updateOne($administrator, $attributes), function () use ($administrator, $roles) {
168
+        return tap($this->updateOne($administrator, $attributes), function() use ($administrator, $roles) {
169 169
             $this->syncRolesByUuids($administrator, $roles);
170 170
         });
171 171
     }
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -147,8 +147,9 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function updateOne(Administrator $administrator, array $attributes): bool
149 149
     {
150
-        if ( ! $administrator->exists)
151
-            return false;
150
+        if ( ! $administrator->exists) {
151
+                    return false;
152
+        }
152 153
 
153 154
         return $administrator->fill($attributes)->save();
154 155
     }
@@ -210,8 +211,9 @@  discard block
 block discarded – undo
210 211
      */
211 212
     public function activate(Administrator $administrator)
212 213
     {
213
-        if ($administrator->isActive())
214
-            return false;
214
+        if ($administrator->isActive()) {
215
+                    return false;
216
+        }
215 217
 
216 218
         event(new ActivatingAdministrator($administrator));
217 219
         $result = $administrator->forceFill(['activated_at' => $administrator->freshTimestamp()])->save();
@@ -229,8 +231,9 @@  discard block
 block discarded – undo
229 231
      */
230 232
     public function deactivate(Administrator $administrator): bool
231 233
     {
232
-        if ( ! $administrator->isActive())
233
-            return false;
234
+        if ( ! $administrator->isActive()) {
235
+                    return false;
236
+        }
234 237
 
235 238
         event(new DeactivatingAdministrator($administrator));
236 239
         $result = $administrator->forceFill(['activated_at' => null])->save();
@@ -303,8 +306,9 @@  discard block
 block discarded – undo
303 306
      */
304 307
     public function syncRoles(Administrator $administrator, Collection $roles): array
305 308
     {
306
-        if (empty($roles))
307
-            return [];
309
+        if (empty($roles)) {
310
+                    return [];
311
+        }
308 312
 
309 313
         event(new SyncingRoles($administrator, $roles));
310 314
         $synced = $administrator->roles()->sync($roles->pluck('id'));
Please login to merge, or discard this patch.
src/Auth/Repositories/UsersRepository.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function onlyTrashed(bool $condition = true)
76 76
     {
77
-        return $this->when($condition, function (Builder $query) {
77
+        return $this->when($condition, function(Builder $query) {
78 78
             return $query->onlyTrashed();
79 79
         });
80 80
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             $attributes['password'] = Str::random(8);
112 112
         }
113 113
 
114
-        return tap($this->model()->fill($attributes), function (User $user) use ($attributes) {
114
+        return tap($this->model()->fill($attributes), function(User $user) use ($attributes) {
115 115
             $user->forceFill([
116 116
                 'uuid'         => $attributes['uuid'] ?? Str::uuid(),
117 117
                 'activated_at' => $attributes['activated_at'] ?? now(), // TODO: Add a setting to change this
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -160,8 +160,9 @@  discard block
 block discarded – undo
160 160
         foreach ($model->getDirty() as $name => $value) {
161 161
             $event = $name.'.'.$type;
162 162
 
163
-            if ( ! array_key_exists($event, $attributesEvents))
164
-                continue;
163
+            if ( ! array_key_exists($event, $attributesEvents)) {
164
+                            continue;
165
+            }
165 166
 
166 167
             return in_array($name, $model->getHidden())
167 168
                 ? event(new $attributesEvents[$event]($model))
@@ -214,8 +215,9 @@  discard block
 block discarded – undo
214 215
      */
215 216
     public function activateOne(User $user)
216 217
     {
217
-        if ($user->isActive())
218
-            return false;
218
+        if ($user->isActive()) {
219
+                    return false;
220
+        }
219 221
 
220 222
         event(new ActivatingUser($user));
221 223
         $result = $user->forceFill(['activated_at' => $user->freshTimestamp()])->save();
@@ -233,8 +235,9 @@  discard block
 block discarded – undo
233 235
      */
234 236
     public function deactivateOne(User $user): bool
235 237
     {
236
-        if ( ! $user->isActive())
237
-            return false;
238
+        if ( ! $user->isActive()) {
239
+                    return false;
240
+        }
238 241
 
239 242
         event(new DeactivatingUser($user));
240 243
         $result = $user->forceFill(['activated_at' => null])->save();
@@ -264,8 +267,9 @@  discard block
 block discarded – undo
264 267
      */
265 268
     public function restoreOne(User $user)
266 269
     {
267
-        if ( ! $user->trashed())
268
-            return null;
270
+        if ( ! $user->trashed()) {
271
+                    return null;
272
+        }
269 273
 
270 274
         return $user->restore();
271 275
     }
Please login to merge, or discard this patch.
src/Auth/Socialite.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $providers = Auth::config('authentication.socialite.providers', []);
34 34
 
35
-        return Collection::make($providers)->transform(function (array $provider, string $key) {
35
+        return Collection::make($providers)->transform(function(array $provider, string $key) {
36 36
             return new SocialiteProvider(array_merge($provider, ['type' => $key]));
37 37
         });
38 38
     }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public static function getEnabledProviders(): Collection
46 46
     {
47
-        return static::getProviders()->filter(function (SocialiteProvider $provider) {
47
+        return static::getProviders()->filter(function(SocialiteProvider $provider) {
48 48
             return $provider->enabled ?? false;
49 49
         });
50 50
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     {
61 61
         $options = config("services.{$provider}", []);
62 62
 
63
-        return tap(static::driver($provider), function (Provider $socialite) use ($provider, $options) {
63
+        return tap(static::driver($provider), function(Provider $socialite) use ($provider, $options) {
64 64
             $scopes = $options['scopes'] ?? [];
65 65
             $with   = $options['with'] ?? [];
66 66
             $fields = $options['fields'] ?? [];
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -65,14 +65,17 @@
 block discarded – undo
65 65
             $with   = $options['with'] ?? [];
66 66
             $fields = $options['fields'] ?? [];
67 67
 
68
-            if ( ! empty($scopes))
69
-                $socialite->scopes($scopes);
68
+            if ( ! empty($scopes)) {
69
+                            $socialite->scopes($scopes);
70
+            }
70 71
 
71
-            if ( ! empty($with))
72
-                $socialite->with($with);
72
+            if ( ! empty($with)) {
73
+                            $socialite->with($with);
74
+            }
73 75
 
74
-            if ( ! empty($fields))
75
-                $socialite->fields($fields);
76
+            if ( ! empty($fields)) {
77
+                            $socialite->fields($fields);
78
+            }
76 79
         })->redirect();
77 80
     }
78 81
 
Please login to merge, or discard this patch.
src/Auth/Console/MakeUser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
      */
71 71
     protected static function defaultCreateUserCallback(): Closure
72 72
     {
73
-        return function (string $firstName, string $lastName, string $email, string $password) {
73
+        return function(string $firstName, string $lastName, string $email, string $password) {
74 74
             /** @var  \Arcanesoft\Foundation\Auth\Repositories\UsersRepository  $repo */
75 75
             $repo = app(UsersRepository::class);
76 76
             $now  = now();
Please login to merge, or discard this patch.
src/Auth/Console/MakeAdmin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
      */
72 72
     protected static function defaultCreateUserCallback(): Closure
73 73
     {
74
-        return function (string $firstName, string $lastName, string $email, string $password) {
74
+        return function(string $firstName, string $lastName, string $email, string $password) {
75 75
             $repo = static::getAdministratorsRepository();
76 76
 
77 77
             $administrator = $repo->createOne([
Please login to merge, or discard this patch.
src/Auth/Session/DatabaseSessionHandler.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@
 block discarded – undo
212 212
             return $payload;
213 213
         }
214 214
 
215
-        return tap($payload, function (&$payload) {
215
+        return tap($payload, function(&$payload) {
216 216
             $this->addUserInformation($payload);
217 217
             $this->addRequestInformation($payload);
218 218
         });
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,8 +98,9 @@  discard block
 block discarded – undo
98 98
     {
99 99
         $session = $this->findSession($sessionId);
100 100
 
101
-        if (is_null($session))
102
-            return '';
101
+        if (is_null($session)) {
102
+                    return '';
103
+        }
103 104
 
104 105
         if ($session->hasExpired()) {
105 106
             $this->exists = true;
@@ -148,8 +149,7 @@  discard block
 block discarded – undo
148 149
 
149 150
         try {
150 151
             return $this->repo->newModelInstance($attributes)->save();
151
-        }
152
-        catch (QueryException $e) {
152
+        } catch (QueryException $e) {
153 153
             $this->performUpdate($sessionId, $attributes);
154 154
         }
155 155
 
Please login to merge, or discard this patch.
src/Auth/Views/Components/UsersDatatable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,13 +77,13 @@
 block discarded – undo
77 77
     {
78 78
         return $repo
79 79
             ->onlyTrashed($this->trash)
80
-            ->unless(empty($this->search), function (Builder $query) {
80
+            ->unless(empty($this->search), function(Builder $query) {
81 81
                 $query
82 82
                     ->where('first_name', 'like', '%'.$this->search.'%')
83 83
                     ->orWhere('last_name', 'like', '%'.$this->search.'%')
84 84
                     ->orWhere('email', 'like', '%'.$this->search.'%');
85 85
             })
86
-            ->unless(empty($this->sortField), function (Builder $query) {
86
+            ->unless(empty($this->sortField), function(Builder $query) {
87 87
                 $query->orderBy($this->sortField, $this->getSortDirection());
88 88
             })
89 89
             ->paginate($this->perPage);
Please login to merge, or discard this patch.