Passed
Push — main ( 4b253d...dd6a50 )
by ikechukwu
12:14
created
src/Traits/Helpers.php 2 patches
Spacing   +10 added lines, -10 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 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;
@@ -110,35 +110,35 @@  discard block
 block discarded – undo
110 110
     public function generateSalt(int $length = 9, bool $add_dashes = false, string $available_sets = 'luds'): string
111 111
     {
112 112
         $sets = [];
113
-        if(strpos($available_sets, 'l') !== false)
113
+        if (strpos($available_sets, 'l') !== false)
114 114
             $sets[] = 'abcdefghjkmnpqrstuvwxyz';
115
-        if(strpos($available_sets, 'u') !== false)
115
+        if (strpos($available_sets, 'u') !== false)
116 116
             $sets[] = 'ABCDEFGHJKMNPQRSTUVWXYZ';
117
-        if(strpos($available_sets, 'd') !== false)
117
+        if (strpos($available_sets, 'd') !== false)
118 118
             $sets[] = '23456789';
119
-        if(strpos($available_sets, 's') !== false)
119
+        if (strpos($available_sets, 's') !== false)
120 120
             $sets[] = '!@#$%&*?';
121 121
 
122 122
         $all = '';
123 123
         $salt = '';
124
-        foreach($sets as $set)
124
+        foreach ($sets as $set)
125 125
         {
126 126
             $salt .= $set[array_rand(str_split($set))];
127 127
             $all .= $set;
128 128
         }
129 129
 
130 130
         $all = str_split($all);
131
-        for($i = 0; $i < $length - count($sets); $i++)
131
+        for ($i = 0; $i < $length - count($sets); $i++)
132 132
             $salt .= $all[array_rand($all)];
133 133
 
134 134
         $salt = str_shuffle($salt);
135 135
 
136
-        if(!$add_dashes)
136
+        if (!$add_dashes)
137 137
             return $salt;
138 138
 
139 139
         $dash_len = floor(sqrt($length));
140 140
         $dash_str = '';
141
-        while(strlen($salt) > $dash_len)
141
+        while (strlen($salt) > $dash_len)
142 142
         {
143 143
             $dash_str .= substr($salt, 0, $dash_len) . '-';
144 144
             $salt = substr($salt, $dash_len);
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -110,14 +110,18 @@  discard block
 block discarded – undo
110 110
     public function generateSalt(int $length = 9, bool $add_dashes = false, string $available_sets = 'luds'): string
111 111
     {
112 112
         $sets = [];
113
-        if(strpos($available_sets, 'l') !== false)
114
-            $sets[] = 'abcdefghjkmnpqrstuvwxyz';
115
-        if(strpos($available_sets, 'u') !== false)
116
-            $sets[] = 'ABCDEFGHJKMNPQRSTUVWXYZ';
117
-        if(strpos($available_sets, 'd') !== false)
118
-            $sets[] = '23456789';
119
-        if(strpos($available_sets, 's') !== false)
120
-            $sets[] = '!@#$%&*?';
113
+        if(strpos($available_sets, 'l') !== false) {
114
+                    $sets[] = 'abcdefghjkmnpqrstuvwxyz';
115
+        }
116
+        if(strpos($available_sets, 'u') !== false) {
117
+                    $sets[] = 'ABCDEFGHJKMNPQRSTUVWXYZ';
118
+        }
119
+        if(strpos($available_sets, 'd') !== false) {
120
+                    $sets[] = '23456789';
121
+        }
122
+        if(strpos($available_sets, 's') !== false) {
123
+                    $sets[] = '!@#$%&*?';
124
+        }
121 125
 
122 126
         $all = '';
123 127
         $salt = '';
@@ -128,13 +132,15 @@  discard block
 block discarded – undo
128 132
         }
129 133
 
130 134
         $all = str_split($all);
131
-        for($i = 0; $i < $length - count($sets); $i++)
132
-            $salt .= $all[array_rand($all)];
135
+        for($i = 0; $i < $length - count($sets); $i++) {
136
+                    $salt .= $all[array_rand($all)];
137
+        }
133 138
 
134 139
         $salt = str_shuffle($salt);
135 140
 
136
-        if(!$add_dashes)
137
-            return $salt;
141
+        if(!$add_dashes) {
142
+                    return $salt;
143
+        }
138 144
 
139 145
         $dash_len = floor(sqrt($length));
140 146
         $dash_str = '';
Please login to merge, or discard this patch.
src/Console/Kernel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      */
31 31
     protected function commands()
32 32
     {
33
-        $this->load(__DIR__.'/Commands');
33
+        $this->load(__DIR__ . '/Commands');
34 34
 
35 35
         require base_path('routes/console.php');
36 36
     }
Please login to merge, or discard this patch.
src/Console/Commands/RoutesCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,20 +30,20 @@
 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
         if ($this->option('sample')) {
38 38
             file_put_contents(
39 39
                 base_path('routes/api.php'),
40
-                file_get_contents(__DIR__.'/stubs/Route/api.stub'),
40
+                file_get_contents(__DIR__ . '/stubs/Route/api.stub'),
41 41
                 FILE_APPEND
42 42
             );
43 43
         } else {
44 44
             file_put_contents(
45 45
                 base_path('routes/api.php'),
46
-                file_get_contents(__DIR__.'/stubs/Route/api-duck.stub'),
46
+                file_get_contents(__DIR__ . '/stubs/Route/api-duck.stub'),
47 47
                 FILE_APPEND
48 48
             );
49 49
         }
Please login to merge, or discard this patch.
src/Console/Commands/ServiceMakeCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $request = $this->option('request');
54 54
 
55
-        if (! Str::startsWith($request, [
55
+        if (!Str::startsWith($request, [
56 56
             $this->laravel->getNamespace(),
57 57
             'Illuminate',
58 58
             '\\',
59 59
         ])) {
60
-            $request = $this->laravel->getNamespace().'Http\\Requests\\'.str_replace('/', '\\', $request);
60
+            $request = $this->laravel->getNamespace() . 'Http\\Requests\\' . str_replace('/', '\\', $request);
61 61
         }
62 62
 
63 63
         $stub = str_replace(
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
     protected function getStub()
90 90
     {
91 91
         if ($this->option('request')) {
92
-            return __DIR__.'/stubs/Service/service.stub';
92
+            return __DIR__ . '/stubs/Service/service.stub';
93 93
         }
94 94
 
95
-        return __DIR__.'/stubs/Service/service-duck.stub';
95
+        return __DIR__ . '/stubs/Service/service-duck.stub';
96 96
     }
97 97
 
98 98
     /**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     {
106 106
         return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
107 107
                         ? $customPath
108
-                        : __DIR__.$stub;
108
+                        : __DIR__ . $stub;
109 109
     }
110 110
 
111 111
     /**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     protected function getDefaultNamespace($rootNamespace)
118 118
     {
119
-        return $rootNamespace.'\Services';
119
+        return $rootNamespace . '\Services';
120 120
     }
121 121
 
122 122
     /**
Please login to merge, or discard this patch.
src/Console/Commands/DatabaseBackUpCommand.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,11 +28,10 @@
 block discarded – undo
28 28
     public function handle()
29 29
     {
30 30
         $command = config('sanctumauthstarter.console.remote_access') ?
31
-        config('sanctumauthstarter.console.remote_backup_command') :
32
-        config('sanctumauthstarter.console.local_backup_command');
31
+        config('sanctumauthstarter.console.remote_backup_command') : config('sanctumauthstarter.console.local_backup_command');
33 32
 
34 33
         $returnVar = NULL;
35
-        $output  = NULL;
34
+        $output = NULL;
36 35
 
37 36
         exec($command, $output, $returnVar);
38 37
     }
Please login to merge, or discard this patch.
src/Console/Commands/ControllersCommand.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -31,50 +31,50 @@
 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/Auth/Controllers'))
49
-            ->each(function (SplFileInfo $file) use ($filesystem) {
48
+        collect($filesystem->allFiles(__DIR__ . '/stubs/Auth/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/Auth/Requests'))
57
-            ->each(function (SplFileInfo $file) use ($filesystem) {
56
+        collect($filesystem->allFiles(__DIR__ . '/stubs/Auth/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/Auth/Services'))
65
-            ->each(function (SplFileInfo $file) use ($filesystem) {
64
+        collect($filesystem->allFiles(__DIR__ . '/stubs/Auth/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
 
72 72
         if ($this->option('sample')) {
73
-            collect($filesystem->allFiles(__DIR__.'/stubs/Auth/Controllers/Sample'))
74
-                ->each(function (SplFileInfo $file) use ($filesystem) {
73
+            collect($filesystem->allFiles(__DIR__ . '/stubs/Auth/Controllers/Sample'))
74
+                ->each(function(SplFileInfo $file) use ($filesystem) {
75 75
                     $filesystem->copy(
76 76
                         $file->getPathname(),
77
-                        app_path('Http/Controllers/Auth/'.Str::replaceLast('.stub', '.php', $file->getFilename()))
77
+                        app_path('Http/Controllers/Auth/' . Str::replaceLast('.stub', '.php', $file->getFilename()))
78 78
                     );
79 79
                 });
80 80
         }
Please login to merge, or discard this patch.
src/migrations/2023_02_10_161638_create_user_password_holders_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('user_password_holders', function (Blueprint $table) {
16
+        Schema::create('user_password_holders', function(Blueprint $table) {
17 17
             $table->id();
18 18
             $table->foreignId('user_id');
19 19
             $table->string('password')->nullable();
Please login to merge, or discard this patch.
src/migrations/2022_10_11_234205_add_column_pin_to_users_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public function up()
16 16
     {
17
-        Schema::table('users', function (Blueprint $table) {
17
+        Schema::table('users', function(Blueprint $table) {
18 18
             $table->string('pin')->after('password')->default(Hash::make(config('sanctumauthstarter.pin.default', '0000')));
19 19
             $table->tinyInteger('default_pin')->after('pin')->default(1);
20 20
         });
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function down()
29 29
     {
30
-        Schema::table('users', function (Blueprint $table) {
30
+        Schema::table('users', function(Blueprint $table) {
31 31
             $table->dropColumn('pin');
32 32
             $table->dropColumn('default_pin');
33 33
         });
Please login to merge, or discard this patch.
src/migrations/2023_02_06_192917_create_web_view_logins_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('web_view_logins', function (Blueprint $table) {
16
+        Schema::create('web_view_logins', function(Blueprint $table) {
17 17
             $table->id();
18 18
             $table->string('user_uuid', 45);
19 19
             $table->foreignId('user_id')->nullable();
Please login to merge, or discard this patch.