1414class Console
1515{
1616
17- protected static $ phpCommand = 'php public/index.php ' ;
17+ protected static $ phpCommand = '' ;
1818
1919 private static $ rootpath = '' ;
2020
@@ -34,6 +34,11 @@ class Console
3434
3535 private static $ sylynderEngine = 'sylynder/engine ' ;
3636
37+ public static function phpCommand ()
38+ {
39+ return Console::userConstants ()->PHP_CLI_VERSION . ' public/index.php ' ;
40+ }
41+
3742 /**
3843 * Grab available defined user constants
3944 */
@@ -157,47 +162,47 @@ public static function executeCommand()
157162 break ;
158163 case 'key:generate ' :
159164 static ::consoleEnv ();
160- static ::runSystemCommand (static :: $ phpCommand . 'key/prepare ' );
165+ static ::runSystemCommand (Console:: phpCommand () . 'key/prepare ' );
161166
162167 if ($ arg2 == "--regenerate " ) {
163- static ::runSystemCommand (static :: $ phpCommand . 'key/regenerate ' );
168+ static ::runSystemCommand (Console:: phpCommand () . 'key/regenerate ' );
164169 exit ;
165170 }
166171
167- static ::runSystemCommand (static :: $ phpCommand . 'key ' );
172+ static ::runSystemCommand (Console:: phpCommand () . 'key ' );
168173 break ;
169174 case 'migrate ' :
170175 static ::consoleEnv ();
171- static ::runSystemCommand (static :: $ phpCommand . 'migrate ' );
176+ static ::runSystemCommand (Console:: phpCommand () . 'migrate ' );
172177 break ;
173178 case 'list:routes ' :
174- static ::runSystemCommand (static :: $ phpCommand . 'routes ' );
179+ static ::runSystemCommand (Console:: phpCommand () . 'routes ' );
175180 break ;
176181 case 'app:on ' :
177- static ::runSystemCommand (static :: $ phpCommand . 'maintenance/on ' );
182+ static ::runSystemCommand (Console:: phpCommand () . 'maintenance/on ' );
178183 break ;
179184 case 'app:off ' :
180- static ::runSystemCommand (static :: $ phpCommand . 'maintenance/off ' );
185+ static ::runSystemCommand (Console:: phpCommand () . 'maintenance/off ' );
181186 break ;
182187 case 'app:to-production ' :
183- static ::runSystemCommand (static :: $ phpCommand . 'environment/production ' );
188+ static ::runSystemCommand (Console:: phpCommand () . 'environment/production ' );
184189 break ;
185190 case 'app:to-testing ' :
186- static ::runSystemCommand (static :: $ phpCommand . 'environment/testing ' );
191+ static ::runSystemCommand (Console:: phpCommand () . 'environment/testing ' );
187192 break ;
188193 case 'app:to-development ' :
189- static ::runSystemCommand (static :: $ phpCommand . 'environment/development ' );
194+ static ::runSystemCommand (Console:: phpCommand () . 'environment/development ' );
190195 break ;
191196 case 'resource:link ' :
192197 static ::consoleEnv ();
193- static ::runSystemCommand (static :: $ phpCommand . 'create/resourcelink ' );
198+ static ::runSystemCommand (Console:: phpCommand () . 'create/resourcelink ' );
194199 break ;
195200 case 'use:command ' :
196201 if (empty ($ arg2 )) {
197202 echo ConsoleColor::red ("No arguments provided! " ) . "\n" ;
198203 exit ;
199204 }
200- static ::runSystemCommand (static :: $ phpCommand . $ arg2 );
205+ static ::runSystemCommand (Console:: phpCommand () . $ arg2 );
201206 break ;
202207 case 'git:init ' :
203208 static ::consoleEnv ();
@@ -308,7 +313,7 @@ protected static function createPackage(...$args)
308313 $ with = $ args [1 ];
309314 }
310315
311- $ command = static :: $ phpCommand . 'create/createpackage/ ' . $ name . '/ ' . $ type . '/ ' . $ with ;
316+ $ command = Console:: phpCommand () . 'create/createpackage/ ' . $ name . '/ ' . $ type . '/ ' . $ with ;
312317 static ::runSystemCommand ($ command );
313318 }
314319
@@ -331,7 +336,7 @@ protected static function createModule(...$args)
331336 $ with = $ args [1 ];
332337 }
333338
334- $ command = static :: $ phpCommand . 'create/createmodule/ ' . $ name . '/ ' . $ type . '/ ' . $ with ;
339+ $ command = Console:: phpCommand () . 'create/createmodule/ ' . $ name . '/ ' . $ type . '/ ' . $ with ;
335340 static ::runSystemCommand ($ command );
336341 }
337342
@@ -361,7 +366,7 @@ protected static function createController(...$args)
361366 }
362367
363368 $ module = str_replace ('= ' ,': ' , $ module );
364- $ command = static :: $ phpCommand . 'create/createcontroller/ ' . $ module . '/ ' . $ controllerName . '/ ' . $ addController ;
369+ $ command = Console:: phpCommand () . 'create/createcontroller/ ' . $ module . '/ ' . $ controllerName . '/ ' . $ addController ;
365370 static ::runSystemCommand ($ command );
366371 }
367372
@@ -403,7 +408,7 @@ protected static function createModel(...$args)
403408 }
404409
405410 $ module = str_replace ('= ' , ': ' , $ module );
406- $ command = static :: $ phpCommand . 'create/createmodel/ ' . $ module . '/ ' . $ modelName . '/ ' . $ modelType . '/ ' . $ removeModel ;
411+ $ command = Console:: phpCommand () . 'create/createmodel/ ' . $ module . '/ ' . $ modelName . '/ ' . $ modelType . '/ ' . $ removeModel ;
407412 static ::runSystemCommand ($ command );
408413 }
409414
@@ -427,7 +432,7 @@ protected static function createService(...$args)
427432 }
428433
429434 $ module = str_replace ('= ' , ': ' , $ module );
430- $ command = static :: $ phpCommand . 'create/createservice/ ' . $ module . '/ ' . $ serviceName ;
435+ $ command = Console:: phpCommand () . 'create/createservice/ ' . $ module . '/ ' . $ serviceName ;
431436 static ::runSystemCommand ($ command );
432437 }
433438
@@ -457,7 +462,7 @@ protected static function createAction(...$args)
457462 }
458463
459464 $ module = str_replace ('= ' , ': ' , $ module );
460- $ command = static :: $ phpCommand . 'create/createaction/ ' . $ module . '/ ' . $ actionName . '/ ' . $ actionType ;
465+ $ command = Console:: phpCommand () . 'create/createaction/ ' . $ module . '/ ' . $ actionName . '/ ' . $ actionType ;
461466 static ::runSystemCommand ($ command );
462467 }
463468
@@ -481,7 +486,7 @@ protected static function createLibrary(...$args)
481486 }
482487
483488 $ module = str_replace ('= ' , ': ' , $ module );
484- $ command = static :: $ phpCommand . 'create/createlibrary/ ' . $ module . '/ ' . $ libraryName ;
489+ $ command = Console:: phpCommand () . 'create/createlibrary/ ' . $ module . '/ ' . $ libraryName ;
485490 static ::runSystemCommand ($ command );
486491 }
487492
@@ -511,7 +516,7 @@ protected static function createHelper(...$args)
511516 }
512517
513518 $ module = str_replace ('= ' , ': ' , $ module );
514- $ command = static :: $ phpCommand . 'create/createhelper/ ' . $ module . '/ ' . $ helperName . '/ ' . $ helperType ;
519+ $ command = Console:: phpCommand () . 'create/createhelper/ ' . $ module . '/ ' . $ helperName . '/ ' . $ helperType ;
515520 static ::runSystemCommand ($ command );
516521 }
517522
@@ -535,7 +540,7 @@ protected static function createForm(...$args)
535540 }
536541
537542 $ module = str_replace ('= ' , ': ' , $ module );
538- $ command = static :: $ phpCommand . 'create/createform/ ' . $ module . '/ ' . $ formName ;
543+ $ command = Console:: phpCommand () . 'create/createform/ ' . $ module . '/ ' . $ formName ;
539544 static ::runSystemCommand ($ command );
540545 }
541546
@@ -565,7 +570,7 @@ protected static function createRule(...$args)
565570 }
566571
567572 $ module = str_replace ('= ' , ': ' , $ module );
568- $ command = static :: $ phpCommand . 'create/createrule/ ' . $ module . '/ ' . $ ruleName ;
573+ $ command = Console:: phpCommand () . 'create/createrule/ ' . $ module . '/ ' . $ ruleName ;
569574 static ::runSystemCommand ($ command );
570575 }
571576
@@ -596,7 +601,7 @@ protected static function createMiddleware(...$args)
596601 exit ;
597602 }
598603
599- $ command = static :: $ phpCommand . 'create/createmiddleware/ ' . $ name . '/ ' . $ type ;
604+ $ command = Console:: phpCommand () . 'create/createmiddleware/ ' . $ name . '/ ' . $ type ;
600605 static ::runSystemCommand ($ command );
601606 }
602607
@@ -627,7 +632,7 @@ protected static function createEnum(...$args)
627632 exit ;
628633 }
629634
630- $ command = static :: $ phpCommand . 'create/createenum/ ' . $ name . '/ ' . $ type ;
635+ $ command = Console:: phpCommand () . 'create/createenum/ ' . $ name . '/ ' . $ type ;
631636 static ::runSystemCommand ($ command );
632637 }
633638
@@ -649,7 +654,7 @@ protected static function createJsonDb(...$args)
649654 exit ;
650655 }
651656
652- $ command = static :: $ phpCommand . 'create/createjsondb/ ' . $ name ;
657+ $ command = Console:: phpCommand () . 'create/createjsondb/ ' . $ name ;
653658 static ::runSystemCommand ($ command );
654659 }
655660
@@ -675,7 +680,7 @@ protected static function createMigration(...$args)
675680 exit ;
676681 }
677682
678- $ command = static :: $ phpCommand . 'create/createmigration/ ' . $ name . '/ ' . $ type ;
683+ $ command = Console:: phpCommand () . 'create/createmigration/ ' . $ name . '/ ' . $ type ;
679684 static ::runSystemCommand ($ command );
680685 }
681686
@@ -685,7 +690,7 @@ protected static function runMigration(...$args)
685690 $ steps = $ args [1 ];
686691
687692 if ($ key == null ) {
688- $ command = static :: $ phpCommand . 'migration/run ' ;
693+ $ command = Console:: phpCommand () . 'migration/run ' ;
689694 static ::runSystemCommand ($ command );
690695 exit ;
691696 }
@@ -710,13 +715,13 @@ protected static function runMigration(...$args)
710715 }
711716
712717 if (!empty ($ step ) && !is_string ($ step ) && is_infinite ($ step )) {
713- $ command = static :: $ phpCommand . 'migration/rollback/ ' . $ step ;
718+ $ command = Console:: phpCommand () . 'migration/rollback/ ' . $ step ;
714719 static ::runSystemCommand ($ command );
715720 exit ;
716721 }
717722
718723 if (!empty ($ step ) && is_numeric ($ step )) {
719- $ command = static :: $ phpCommand . 'migration/rollback/ ' . $ step ;
724+ $ command = Console:: phpCommand () . 'migration/rollback/ ' . $ step ;
720725 static ::runSystemCommand ($ command );
721726 exit ;
722727 }
@@ -729,31 +734,31 @@ protected static function runMigration(...$args)
729734 }
730735
731736 if ($ key === '--later ' ) {
732- $ command = static :: $ phpCommand . 'migration/future ' ;
737+ $ command = Console:: phpCommand () . 'migration/future ' ;
733738 static ::runSystemCommand ($ command );
734739 exit ;
735740 }
736741
737742 if ($ key === '--status ' ) {
738- $ command = static :: $ phpCommand . 'migration/status ' ;
743+ $ command = Console:: phpCommand () . 'migration/status ' ;
739744 static ::runSystemCommand ($ command );
740745 exit ;
741746 }
742747
743748 if ($ key === '--reset ' ) {
744- $ command = static :: $ phpCommand . 'migration/reset ' ;
749+ $ command = Console:: phpCommand () . 'migration/reset ' ;
745750 static ::runSystemCommand ($ command );
746751 exit ;
747752 }
748753
749754 if ($ key === '--latest ' ) {
750- $ command = static :: $ phpCommand . 'migration/latest ' ;
755+ $ command = Console:: phpCommand () . 'migration/latest ' ;
751756 static ::runSystemCommand ($ command );
752757 exit ;
753758 }
754759
755760 if ($ key === '--truncate ' ) {
756- $ command = static :: $ phpCommand . 'migration/truncate ' ;
761+ $ command = Console:: phpCommand () . 'migration/truncate ' ;
757762 static ::runSystemCommand ($ command );
758763 exit ;
759764 }
@@ -764,7 +769,7 @@ protected static function runMigration(...$args)
764769
765770 if ($ steps [0 ] === '--step ' && !empty ($ steps [1 ]) && is_numeric ($ steps [1 ])) {
766771 $ steps = $ steps [1 ];
767- $ command = static :: $ phpCommand . 'migration/run/ ' . $ steps ;
772+ $ command = Console:: phpCommand () . 'migration/run/ ' . $ steps ;
768773 static ::runSystemCommand ($ command );
769774 exit ;
770775 }
@@ -804,9 +809,9 @@ protected static function createView(...$args)
804809 $ viewType = $ args [2 ];
805810 }
806811
807- $ filename = str_replace ('/ ' , ':: ' , $ filename );
812+ $ filename = str_replace ('/ ' , '- ' , $ filename );
808813 $ module = empty ($ module ) ? 'empty ' : $ module ;
809- $ command = static :: $ phpCommand . 'create/createview/ ' . $ module . '/ ' . $ filename . '/ ' . $ viewType ;
814+ $ command = Console:: phpCommand () . 'create/createview/ ' . $ module . '/ ' . $ filename . '/ ' . $ viewType ;
810815
811816 static ::runSystemCommand ($ command );
812817 }
@@ -827,7 +832,7 @@ protected static function clearCache(...$args)
827832
828833 $ type = str_replace ('- ' , '' , $ type );
829834
830- $ command = static :: $ phpCommand . 'cache/clearpath/ ' . $ type ;
835+ $ command = Console:: phpCommand () . 'cache/clearpath/ ' . $ type ;
831836 static ::runSystemCommand ($ command );
832837 exit ;
833838 }
@@ -836,7 +841,7 @@ protected static function clearCache(...$args)
836841
837842 $ type = str_replace ('- ' , '' , $ type );
838843
839- $ command = static :: $ phpCommand . 'cache/clearpath/ ' . $ type ;
844+ $ command = Console:: phpCommand () . 'cache/clearpath/ ' . $ type ;
840845 static ::runSystemCommand ($ command );
841846 exit ;
842847 }
@@ -845,7 +850,7 @@ protected static function clearCache(...$args)
845850
846851 $ type = str_replace ('- ' , '' , $ type );
847852
848- $ command = static :: $ phpCommand . 'cache/clearpath/ ' . $ type ;
853+ $ command = Console:: phpCommand () . 'cache/clearpath/ ' . $ type ;
849854 static ::runSystemCommand ($ command );
850855 exit ;
851856 }
@@ -854,7 +859,7 @@ protected static function clearCache(...$args)
854859
855860 $ type = str_replace ('- ' , '' , $ type );
856861
857- $ command = static :: $ phpCommand . 'cache/clearpath/ ' . $ type ;
862+ $ command = Console:: phpCommand () . 'cache/clearpath/ ' . $ type ;
858863 static ::runSystemCommand ($ command );
859864 exit ;
860865 }
0 commit comments