Passed
Push — main ( bbf0bf...cabb5e )
by ikechukwu
03:53
created
src/migrations/2023_02_03_132926_add_two_factor_field_to_users_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::table('users', function (Blueprint $table) {
16
+        Schema::table('users', function(Blueprint $table) {
17 17
             $table->tinyInteger('two_factor')->after('password')->default(0);
18 18
         });
19 19
     }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function down()
27 27
     {
28
-        Schema::table('users', function (Blueprint $table) {
28
+        Schema::table('users', function(Blueprint $table) {
29 29
             $table->dropColumn('two_factor');
30 30
         });
31 31
     }
Please login to merge, or discard this patch.
src/Console/Commands/ControllersCommand.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -31,41 +31,41 @@
 block discarded – undo
31 31
      */
32 32
     public function handle()
33 33
     {
34
-        if (! is_dir($directory = app_path('Http/Controllers/Auth'))) {
34
+        if (!is_dir($directory = app_path('Http/Controllers/Auth'))) {
35 35
             mkdir($directory, 0755, true);
36 36
         }
37 37
 
38
-        if (! is_dir($directory = app_path('Http/Requests/Auth'))) {
38
+        if (!is_dir($directory = app_path('Http/Requests/Auth'))) {
39 39
             mkdir($directory, 0755, true);
40 40
         }
41 41
 
42
-        if (! is_dir($directory = app_path('Services/Auth'))) {
42
+        if (!is_dir($directory = app_path('Services/Auth'))) {
43 43
             mkdir($directory, 0755, true);
44 44
         }
45 45
 
46 46
         $filesystem = new Filesystem;
47 47
 
48
-        collect($filesystem->allFiles(__DIR__.'/stubs/Controllers'))
49
-            ->each(function (SplFileInfo $file) use ($filesystem) {
48
+        collect($filesystem->allFiles(__DIR__ . '/stubs/Controllers'))
49
+            ->each(function(SplFileInfo $file) use ($filesystem) {
50 50
                 $filesystem->copy(
51 51
                     $file->getPathname(),
52
-                    app_path('Http/Controllers/Auth/'.Str::replaceLast('.stub', '.php', $file->getFilename()))
52
+                    app_path('Http/Controllers/Auth/' . Str::replaceLast('.stub', '.php', $file->getFilename()))
53 53
                 );
54 54
             });
55 55
 
56
-        collect($filesystem->allFiles(__DIR__.'/stubs/Requests'))
57
-            ->each(function (SplFileInfo $file) use ($filesystem) {
56
+        collect($filesystem->allFiles(__DIR__ . '/stubs/Requests'))
57
+            ->each(function(SplFileInfo $file) use ($filesystem) {
58 58
                 $filesystem->copy(
59 59
                     $file->getPathname(),
60
-                    app_path('Http/Requests/Auth/'.Str::replaceLast('.stub', '.php', $file->getFilename()))
60
+                    app_path('Http/Requests/Auth/' . Str::replaceLast('.stub', '.php', $file->getFilename()))
61 61
                 );
62 62
             });
63 63
 
64
-        collect($filesystem->allFiles(__DIR__.'/stubs/Services'))
65
-            ->each(function (SplFileInfo $file) use ($filesystem) {
64
+        collect($filesystem->allFiles(__DIR__ . '/stubs/Services'))
65
+            ->each(function(SplFileInfo $file) use ($filesystem) {
66 66
                 $filesystem->copy(
67 67
                     $file->getPathname(),
68
-                    app_path('Services/Auth/'.Str::replaceLast('.stub', '.php', $file->getFilename()))
68
+                    app_path('Services/Auth/' . Str::replaceLast('.stub', '.php', $file->getFilename()))
69 69
                 );
70 70
             });
71 71
 
Please login to merge, or discard this patch.
src/Console/Commands/RoutesCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@
 block discarded – undo
30 30
     {
31 31
         file_put_contents(
32 32
             base_path('routes/web.php'),
33
-            file_get_contents(__DIR__.'/stubs/Route/web.stub'),
33
+            file_get_contents(__DIR__ . '/stubs/Route/web.stub'),
34 34
             FILE_APPEND
35 35
         );
36 36
 
37 37
         file_put_contents(
38 38
             base_path('routes/api.php'),
39
-            file_get_contents(__DIR__.'/stubs/Route/api.stub'),
39
+            file_get_contents(__DIR__ . '/stubs/Route/api.stub'),
40 40
             FILE_APPEND
41 41
         );
42 42
 
Please login to merge, or discard this patch.
src/Traits/Helpers.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
                         'REMOTE_ADDR'
47 47
                     ];
48 48
 
49
-        foreach ($server_keys as $key){
49
+        foreach ($server_keys as $key) {
50 50
             if (array_key_exists($key, $_SERVER) === true) {
51
-                foreach (explode(',', $_SERVER[$key]) as $ip) {
51
+                foreach (explode(',', $_SERVER[ $key ]) as $ip) {
52 52
                     $ip = trim($ip); // just to be safe
53 53
 
54 54
                     if (filter_var($ip, FILTER_VALIDATE_IP,
55
-                        FILTER_FLAG_NO_PRIV_RANGE |
55
+                        FILTER_FLAG_NO_PRIV_RANGE|
56 56
                         FILTER_FLAG_NO_RES_RANGE) !== false
57 57
                     ) {
58 58
                         return $ip;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     public function getUserLoginInformation(): array
68 68
     {
69
-        $info = [];
69
+        $info = [ ];
70 70
 
71 71
         if (Browser::deviceType() === 'Mobile' ||
72 72
             Browser::deviceType() === 'Tablet') {
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
         }
91 91
 
92 92
         if ($position = Location::get()) {
93
-            $info[] = $position->countryName;
94
-            $info[] = $position->regionName;
95
-            $info[] = $position->cityName;
93
+            $info[ ] = $position->countryName;
94
+            $info[ ] = $position->regionName;
95
+            $info[ ] = $position->cityName;
96 96
         }
97 97
 
98 98
         return $info;
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 
101 101
     public function unknownErrorResponse(): JsonResponse
102 102
     {
103
-        $data = ['message' =>
104
-        trans('sanctumauthstarter::general.unknown_error')];
103
+        $data = [ 'message' =>
104
+        trans('sanctumauthstarter::general.unknown_error') ];
105 105
 
106 106
         return $this->httpJsonResponse(
107 107
             trans('sanctumauthstarter::general.fail'), 422, $data);
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 
110 110
     public function generateSalt(int $length = 9, bool $add_dashes = false, string $available_sets = 'luds'): string
111 111
     {
112
-        [$sets, $salt, $all] = $this->saltsAllVar($available_sets);
112
+        [ $sets, $salt, $all ] = $this->saltsAllVar($available_sets);
113 113
 
114
-        for($i = 0; $i < $length - count($sets); $i++) {
115
-            $salt .= $all[array_rand($all)];
114
+        for ($i = 0; $i < $length - count($sets); $i++) {
115
+            $salt .= $all[ array_rand($all) ];
116 116
         }
117 117
 
118 118
         $salt = str_shuffle($salt);
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
         if ($this->throttleRequestsService->hasTooManyAttempts($request)) {
129 129
             $this->throttleRequestsService->_fireLockoutEvent($request);
130 130
 
131
-            return ["message" => trans($trans,
132
-                        ['seconds' =>
131
+            return [ "message" => trans($trans,
132
+                        [ 'seconds' =>
133 133
                             $this->throttleRequestsService->_limiter()
134 134
                             ->availableIn(
135 135
                                     $this->throttleRequestsService
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
         return null;
145 145
     }
146 146
 
147
-    public function returnTwoFactorLoginView(array $data = []): View
147
+    public function returnTwoFactorLoginView(array $data = [ ]): View
148 148
     {
149
-        $data['input'] = '2fa_code';
149
+        $data[ 'input' ] = '2fa_code';
150 150
 
151 151
         if (!array_key_exists("message", $data)) {
152
-            $data['message'] = trans('sanctumauthstarter::auth.failed');
152
+            $data[ 'message' ] = trans('sanctumauthstarter::auth.failed');
153 153
         }
154 154
 
155 155
         return view('two-factor::login', $data);
@@ -166,22 +166,22 @@  discard block
 block discarded – undo
166 166
 
167 167
     private function stringSets(string $available_sets): array
168 168
     {
169
-        $sets = [];
169
+        $sets = [ ];
170 170
 
171 171
         if (strpos($available_sets, 'l') !== false) {
172
-            $sets[] = 'abcdefghjkmnpqrstuvwxyz';
172
+            $sets[ ] = 'abcdefghjkmnpqrstuvwxyz';
173 173
         }
174 174
 
175 175
         if (strpos($available_sets, 'u') !== false) {
176
-            $sets[] = 'ABCDEFGHJKMNPQRSTUVWXYZ';
176
+            $sets[ ] = 'ABCDEFGHJKMNPQRSTUVWXYZ';
177 177
         }
178 178
 
179 179
         if (strpos($available_sets, 'd') !== false) {
180
-            $sets[] = '23456789';
180
+            $sets[ ] = '23456789';
181 181
         }
182 182
 
183 183
         if (strpos($available_sets, 's') !== false) {
184
-            $sets[] = '!@#$%&*?';
184
+            $sets[ ] = '!@#$%&*?';
185 185
         }
186 186
 
187 187
         return $sets;
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 
196 196
         foreach ($sets as $set)
197 197
         {
198
-            $salt .= $set[array_rand(str_split($set))];
198
+            $salt .= $set[ array_rand(str_split($set)) ];
199 199
             $all .= $set;
200 200
         }
201 201
 
202
-        return [$sets, $salt, str_split($all)];
202
+        return [ $sets, $salt, str_split($all) ];
203 203
     }
204 204
 
205 205
     private function addDashes(string $salt, int $length): string
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         $dash_len = floor(sqrt($length));
208 208
         $dash_str = '';
209 209
 
210
-        while(strlen($salt) > $dash_len)
210
+        while (strlen($salt) > $dash_len)
211 211
         {
212 212
             $dash_str .= substr($salt, 0, $dash_len) . '-';
213 213
             $salt = substr($salt, $dash_len);
Please login to merge, or discard this patch.
src/Rules/DisallowOldPassword.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
      */
65 65
     public function message()
66 66
     {
67
-        return trans_choice('sanctumauthstarter::passwords.exists', intval(is_int($this->checkAll)), ['number' => $this->number]);
67
+        return trans_choice('sanctumauthstarter::passwords.exists', intval(is_int($this->checkAll)), [ 'number' => $this->number ]);
68 68
     }
69 69
 
70 70
     /**
Please login to merge, or discard this patch.
src/Listeners/SendResetLink.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
     public function handle($event)
13 13
     {
14 14
         $this->event = $event;
15
-        Password::sendResetLink(['email' => $this->event->user->email]);
15
+        Password::sendResetLink([ 'email' => $this->event->user->email ]);
16 16
     }
17 17
 }
Please login to merge, or discard this patch.
src/Console/Commands/TestsCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@
 block discarded – undo
31 31
      */
32 32
     public function handle()
33 33
     {
34
-        if (! is_dir($directory = base_path('tests/Feature'))) {
34
+        if (!is_dir($directory = base_path('tests/Feature'))) {
35 35
             mkdir($directory, 0755, true);
36 36
         }
37 37
 
38 38
         $filesystem = new Filesystem;
39 39
 
40
-        collect($filesystem->allFiles(__DIR__.'/stubs/Tests'))
41
-            ->each(function (SplFileInfo $file) use ($filesystem) {
40
+        collect($filesystem->allFiles(__DIR__ . '/stubs/Tests'))
41
+            ->each(function(SplFileInfo $file) use ($filesystem) {
42 42
                 $filesystem->copy(
43 43
                     $file->getPathname(),
44
-                    base_path('tests/Feature/'.Str::replaceLast('.stub', '.php', $file->getFilename()))
44
+                    base_path('tests/Feature/' . Str::replaceLast('.stub', '.php', $file->getFilename()))
45 45
                 );
46 46
             });
47 47
 
Please login to merge, or discard this patch.
src/SanctumauthstarterServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
      * @return void
17 17
      */
18 18
 
19
-    public const LANG = __DIR__.'/lang';
20
-    public const DB = __DIR__.'/migrations';
21
-    public const VIEW = __DIR__.'/views';
22
-    public const CONFIG = __DIR__.'/config/sanctumauthstarter.php';
23
-    public const ACTION = __DIR__.'/.github/workflows';
19
+    public const LANG = __DIR__ . '/lang';
20
+    public const DB = __DIR__ . '/migrations';
21
+    public const VIEW = __DIR__ . '/views';
22
+    public const CONFIG = __DIR__ . '/config/sanctumauthstarter.php';
23
+    public const ACTION = __DIR__ . '/.github/workflows';
24 24
 
25 25
     public function boot()
26 26
     {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public function register()
63 63
     {
64 64
         $this->mergeConfigFrom(
65
-            __DIR__.'/config/sanctumauthstarter.php', 'sanctumauthstarter'
65
+            __DIR__ . '/config/sanctumauthstarter.php', 'sanctumauthstarter'
66 66
         );
67 67
 
68 68
         $this->app->register(EventServiceProvider::class);
Please login to merge, or discard this patch.