Passed
Branch master (d21da9)
by Mokhlas
41:19 queued 32:22
created
src/Command/MultiAuthPrepare.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             $admin_theme = 'adminlte';
78 78
         }
79 79
 
80
-        if (file_exists(__DIR__ . '/../Backpack/Views/'.$admin_theme)) {
80
+        if (file_exists(__DIR__.'/../Backpack/Views/'.$admin_theme)) {
81 81
             if ($this->isAlreadySetup() === false) {
82 82
 
83 83
                 $this->line(" installing migrations...");
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 
175 175
 
176
-        $modelTableContent = file_get_contents(__DIR__ . '/../Migration/modelTable.stub');
176
+        $modelTableContent = file_get_contents(__DIR__.'/../Migration/modelTable.stub');
177 177
         $modelTableContentNew = str_replace([
178 178
             '{{$namePlural}}',
179 179
             '{{$nameSmallPlural}}',
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         ], $modelTableContent);
184 184
 
185 185
 
186
-        $modelResetPasswordTableContent = file_get_contents(__DIR__ . '/../Migration/passwordResetsTable.stub');
186
+        $modelResetPasswordTableContent = file_get_contents(__DIR__.'/../Migration/passwordResetsTable.stub');
187 187
         $modelResetPasswordTableContentNew = str_replace([
188 188
             '{{$namePlural}}',
189 189
             '{{$nameSmallPlural}}',
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
         ], $modelResetPasswordTableContent);
194 194
 
195 195
 
196
-        $migrationName = date('Y_m_d_His') . '_'.'create_' . str_plural(snake_case($name)) .'_table.php';
196
+        $migrationName = date('Y_m_d_His').'_'.'create_'.str_plural(snake_case($name)).'_table.php';
197 197
         $migrationModelPath = $this->getMigrationPath().DIRECTORY_SEPARATOR.$migrationName;
198 198
         file_put_contents($migrationModelPath, $modelTableContentNew);
199 199
 
200
-        $migrationResetName = date('Y_m_d_His') . '_'
201
-            .'create_' . str_plural(snake_case($name))
200
+        $migrationResetName = date('Y_m_d_His').'_'
201
+            .'create_'.str_plural(snake_case($name))
202 202
             .'_password_resets_table.php';
203 203
         $migrationResetModelPath = $this->getMigrationPath().DIRECTORY_SEPARATOR.$migrationResetName;
204 204
         file_put_contents($migrationResetModelPath, $modelResetPasswordTableContentNew);
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         array_push($newChanges, $nameSmallPlural);
233 233
         array_push($newChanges, $nameSmall);
234 234
 
235
-        $modelContent = file_get_contents(__DIR__ . '/../Backpack/Model/model.stub');
235
+        $modelContent = file_get_contents(__DIR__.'/../Backpack/Model/model.stub');
236 236
         $modelContentNew = str_replace($arrayToChange, $newChanges, $modelContent);
237 237
 
238 238
         $createFolder = $this->getAppFolderPath().DIRECTORY_SEPARATOR."Models";
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 
246 246
 
247 247
 
248
-        $resetNotificationContent = file_get_contents(__DIR__ . '/../Notification/resetPasswordNotification.stub');
248
+        $resetNotificationContent = file_get_contents(__DIR__.'/../Notification/resetPasswordNotification.stub');
249 249
         $resetNotificationContentNew = str_replace([
250 250
             '{{$name}}',
251 251
             '{{$nameSmall}}',
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             $nameSmall
255 255
         ], $resetNotificationContent);
256 256
 
257
-        $verifyEmailContent = file_get_contents(__DIR__ . '/../Notification/verifyEmailNotification.stub');
257
+        $verifyEmailContent = file_get_contents(__DIR__.'/../Notification/verifyEmailNotification.stub');
258 258
         $verifyEmailContentNew = str_replace([
259 259
             '{{$name}}',
260 260
             '{{$nameSmall}}',
@@ -286,25 +286,25 @@  discard block
 block discarded – undo
286 286
      */
287 287
     public function installView($theme_name = 'adminlte')
288 288
     {
289
-        if (file_exists(__DIR__ . '/../Backpack/Views/'.$theme_name)) {
289
+        if (file_exists(__DIR__.'/../Backpack/Views/'.$theme_name)) {
290 290
             $nameSmall = snake_case($this->getParsedNameInput());
291 291
             $name = ucfirst($this->getParsedNameInput());
292 292
 
293 293
             // layouts
294
-            $appBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/layouts/layout.blade.stub');
295
-            $appGuestBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/layouts/layout_guest.blade.stub');
294
+            $appBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/layouts/layout.blade.stub');
295
+            $appGuestBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/layouts/layout_guest.blade.stub');
296 296
 
297 297
             // home
298
-            $homeBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/home.blade.stub');
298
+            $homeBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/home.blade.stub');
299 299
 
300 300
             // auth
301
-            $loginBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/login.blade.stub');
302
-            $registerBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/register.blade.stub');
303
-            $verifyEmailBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/verify.blade.stub');
301
+            $loginBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/login.blade.stub');
302
+            $registerBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/register.blade.stub');
303
+            $verifyEmailBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/verify.blade.stub');
304 304
 
305 305
             // auth/passwords
306
-            $resetBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/passwords/reset.blade.stub');
307
-            $emailBlade = file_get_contents(__DIR__ . '/../Backpack/Views/'.$theme_name.'/auth/passwords/email.blade.stub');
306
+            $resetBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/passwords/reset.blade.stub');
307
+            $emailBlade = file_get_contents(__DIR__.'/../Backpack/Views/'.$theme_name.'/auth/passwords/email.blade.stub');
308 308
 
309 309
             // auth/account
310 310
             $update_infoBlade = file_get_contents(__DIR__
@@ -573,10 +573,10 @@  discard block
 block discarded – undo
573 573
     {
574 574
         $nameSmall = snake_case($this->getParsedNameInput());
575 575
         $name = ucfirst($this->getParsedNameInput());
576
-        $mapCallFunction = file_get_contents(__DIR__ . '/../Route/mapRoute.stub');
576
+        $mapCallFunction = file_get_contents(__DIR__.'/../Route/mapRoute.stub');
577 577
         $mapCallFunctionNew = str_replace('{{$name}}', "$name", $mapCallFunction);
578 578
         $this->insert($this->getRouteServicesPath(), '$this->mapWebRoutes();', $mapCallFunctionNew, true);
579
-        $mapFunction = file_get_contents(__DIR__ . '/../Route/mapRouteFunction.stub');
579
+        $mapFunction = file_get_contents(__DIR__.'/../Route/mapRouteFunction.stub');
580 580
         $mapFunctionNew = str_replace([
581 581
             '{{$name}}',
582 582
             '{{$nameSmall}}'
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 
595 595
         $routeServicesContent = file_get_contents($this->getRouteServicesPath());
596 596
 
597
-        if (str_contains($routeServicesContent,'$this->map'.$name.'Routes();')) {
597
+        if (str_contains($routeServicesContent, '$this->map'.$name.'Routes();')) {
598 598
             return true;
599 599
         }
600 600
         return false;
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
         if (!file_exists($createFolder)) {
615 615
             mkdir($createFolder);
616 616
         }
617
-        $routeFileContent = file_get_contents(__DIR__ . '/../Route/routeFile.stub');
617
+        $routeFileContent = file_get_contents(__DIR__.'/../Route/routeFile.stub');
618 618
         $routeFileContentNew = str_replace([
619 619
             '{{$name}}',
620 620
             '{{$nameSmall}}'
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
         if (!file_exists($requestsFolder)) {
648 648
             mkdir($requestsFolder);
649 649
         }
650
-        $accountInfoContent = file_get_contents(__DIR__ . '/../Request/AccountInfoRequest.stub');
651
-        $changePasswordContent = file_get_contents(__DIR__ . '/../Request/ChangePasswordRequest.stub');
650
+        $accountInfoContent = file_get_contents(__DIR__.'/../Request/AccountInfoRequest.stub');
651
+        $changePasswordContent = file_get_contents(__DIR__.'/../Request/ChangePasswordRequest.stub');
652 652
 
653 653
         $accountInfoContentNew = str_replace([
654 654
             '{{$name}}',
@@ -697,14 +697,14 @@  discard block
 block discarded – undo
697 697
             mkdir($authFolder);
698 698
         }
699 699
 
700
-        $controllerContent = file_get_contents(__DIR__ . '/../Controllers/Controller.stub');
701
-        $homeControllerContent = file_get_contents(__DIR__ . '/../Controllers/HomeController.stub');
702
-        $loginControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/LoginController.stub');
703
-        $forgotControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/ForgotPasswordController.stub');
704
-        $registerControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/RegisterController.stub');
705
-        $resetControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/ResetPasswordController.stub');
706
-        $myAccountControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/MyAccountController.stub');
707
-        $verificationControllerContent = file_get_contents(__DIR__ . '/../Controllers/Auth/VerificationController.stub');
700
+        $controllerContent = file_get_contents(__DIR__.'/../Controllers/Controller.stub');
701
+        $homeControllerContent = file_get_contents(__DIR__.'/../Controllers/HomeController.stub');
702
+        $loginControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/LoginController.stub');
703
+        $forgotControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/ForgotPasswordController.stub');
704
+        $registerControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/RegisterController.stub');
705
+        $resetControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/ResetPasswordController.stub');
706
+        $myAccountControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/MyAccountController.stub');
707
+        $verificationControllerContent = file_get_contents(__DIR__.'/../Controllers/Auth/VerificationController.stub');
708 708
 
709 709
         $controllerFileContentNew = str_replace('{{$name}}', "$name", $controllerContent);
710 710
 
@@ -808,9 +808,9 @@  discard block
 block discarded – undo
808 808
 
809 809
         $authConfigFile = $this->getConfigsFolderPath().DIRECTORY_SEPARATOR."auth.php";
810 810
 
811
-        $guardContent = file_get_contents(__DIR__ . '/../Config/guard.stub');
812
-        $passwordContent = file_get_contents(__DIR__ . '/../Config/password.stub');
813
-        $providerContent = file_get_contents(__DIR__ . '/../Config/provider.stub');
811
+        $guardContent = file_get_contents(__DIR__.'/../Config/guard.stub');
812
+        $passwordContent = file_get_contents(__DIR__.'/../Config/password.stub');
813
+        $providerContent = file_get_contents(__DIR__.'/../Config/provider.stub');
814 814
 
815 815
         $guardFileContentNew = str_replace([
816 816
             '{{$nameSmall}}',
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
         $exceptionHandlerFile = $this->getAppFolderPath().DIRECTORY_SEPARATOR."Exceptions".DIRECTORY_SEPARATOR
852 852
             ."Handler.php";
853 853
         $exceptionHandlerFileContent = file_get_contents($exceptionHandlerFile);
854
-        $exceptionHandlerFileContentNew = file_get_contents(__DIR__ . '/../Exceptions/handlerUnauthorized.stub');
854
+        $exceptionHandlerFileContentNew = file_get_contents(__DIR__.'/../Exceptions/handlerUnauthorized.stub');
855 855
 
856 856
 
857 857
         if (!str_contains($exceptionHandlerFileContent, 'MultiAuthUnAuthenticated')) {
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
             }
863 863
         }
864 864
 
865
-        $exceptionHandlerGuardContentNew = file_get_contents(__DIR__ . '/../Exceptions/handlerGuard.stub');
865
+        $exceptionHandlerGuardContentNew = file_get_contents(__DIR__.'/../Exceptions/handlerGuard.stub');
866 866
         $exceptionHandlerGuardContentNew2 = str_replace('{{$nameSmall}}', "$nameSmall",
867 867
             $exceptionHandlerGuardContentNew);
868 868
 
@@ -891,9 +891,9 @@  discard block
 block discarded – undo
891 891
         $redirectIfMiddlewareFileContent = file_get_contents($redirectIfMiddlewareFile);
892 892
         $authenticateMiddlewareFileContent = file_get_contents($redirectIfMiddlewareFile);
893 893
 
894
-        $ensureEmailIsVerifiedMiddlewareFileeContent = file_get_contents(__DIR__ . '/../Middleware/ensureEmailIsVerified.stub');
895
-        $redirectIfMiddlewareContentNew = file_get_contents(__DIR__ . '/../Middleware/redirectIf.stub');
896
-        $authenticateMiddlewareContentNew = file_get_contents(__DIR__ . '/../Middleware/authenticate.stub');
894
+        $ensureEmailIsVerifiedMiddlewareFileeContent = file_get_contents(__DIR__.'/../Middleware/ensureEmailIsVerified.stub');
895
+        $redirectIfMiddlewareContentNew = file_get_contents(__DIR__.'/../Middleware/redirectIf.stub');
896
+        $authenticateMiddlewareContentNew = file_get_contents(__DIR__.'/../Middleware/authenticate.stub');
897 897
 
898 898
         if (!file_exists($ensureEmailIsVerifiedMiddlewareFile)) {
899 899
             file_put_contents($ensureEmailIsVerifiedMiddlewareFile, $ensureEmailIsVerifiedMiddlewareFileeContent);
@@ -915,9 +915,9 @@  discard block
 block discarded – undo
915 915
             }
916 916
         }
917 917
 
918
-        $redirectIfMiddlewareGroupContentNew = file_get_contents(__DIR__ . '/../Middleware/redirectMiddleware.stub');
919
-        $redirectIfMiddlewareGuardContentNew = file_get_contents(__DIR__ . '/../Middleware/redirectMiddlewareGuard.stub');
920
-        $authenticateIfMiddlewareGuardContentNew = file_get_contents(__DIR__ . '/../Middleware/authenticateIf.stub');
918
+        $redirectIfMiddlewareGroupContentNew = file_get_contents(__DIR__.'/../Middleware/redirectMiddleware.stub');
919
+        $redirectIfMiddlewareGuardContentNew = file_get_contents(__DIR__.'/../Middleware/redirectMiddlewareGuard.stub');
920
+        $authenticateIfMiddlewareGuardContentNew = file_get_contents(__DIR__.'/../Middleware/authenticateIf.stub');
921 921
 
922 922
         $redirectIfMiddlewareGroupContentNew2 = str_replace('{{$nameSmall}}', "$nameSmall",
923 923
             $redirectIfMiddlewareGroupContentNew);
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
             $this->info('### Running: '.$command);
957 957
         }
958 958
         $process = new Process($command);
959
-        $process->run(function ($type, $buffer) {
959
+        $process->run(function($type, $buffer) {
960 960
             if (Process::ERR === $type) {
961 961
                 echo '... > '.$buffer;
962 962
             } else {
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
      */
1111 1111
     public function insertIntoFile($filePath, $insertMarker, $text, $after = true) {
1112 1112
         $contents = file_get_contents($filePath);
1113
-        $new_contents = preg_replace($insertMarker,($after) ? '$0' . $text : $text . '$0', $contents);
1113
+        $new_contents = preg_replace($insertMarker, ($after) ? '$0'.$text : $text.'$0', $contents);
1114 1114
         return file_put_contents($filePath, $new_contents);
1115 1115
     }
1116 1116
 
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
     public function insert($filePath, $keyword, $body, $after = true) {
1128 1128
 
1129 1129
         $contents = file_get_contents($filePath);
1130
-        $new_contents = substr_replace($contents, PHP_EOL . $body,
1130
+        $new_contents = substr_replace($contents, PHP_EOL.$body,
1131 1131
             ($after) ? strpos($contents, $keyword) + strlen($keyword) : strpos($contents, $keyword)
1132 1132
             , 0);
1133 1133
         return file_put_contents($filePath, $new_contents);
Please login to merge, or discard this patch.