@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | { |
27 | 27 | // we check that they are in |
28 | 28 | // the console to run the console commands in the kernel. |
29 | - if(Utils::isNamespaceExists($this->consoleClassNamespace)){ |
|
29 | + if (Utils::isNamespaceExists($this->consoleClassNamespace)) { |
|
30 | 30 | return call_user_func($callback); |
31 | 31 | } |
32 | 32 | |
33 | 33 | // if the kernel console is not found |
34 | 34 | // then we check the existence of the specific application command and run it if it is. |
35 | - return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(),$this))->handle(); |
|
35 | + return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(), $this))->handle(); |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected function consoleEventHandler($args) |
46 | 46 | { |
47 | - if(isset($this->app['eventDispatcher'])){ |
|
47 | + if (isset($this->app['eventDispatcher'])) { |
|
48 | 48 | |
49 | 49 | $listeners = event()->getListeners(); |
50 | 50 | |
51 | - if(isset($args['event']) && isset($listeners['console'])){ |
|
51 | + if (isset($args['event']) && isset($listeners['console'])) { |
|
52 | 52 | |
53 | - if(strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])){ |
|
53 | + if (strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])) { |
|
54 | 54 | |
55 | 55 | $event = $listeners['console'][strtolower($args['event'])]; |
56 | - return call_user_func_array($event,['app'=>$this->app,'args'=>$args,]); |
|
56 | + return call_user_func_array($event, ['app'=>$this->app, 'args'=>$args, ]); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | - if(isset($listeners['console']['default'])){ |
|
60 | + if (isset($listeners['console']['default'])) { |
|
61 | 61 | |
62 | 62 | $event = $listeners['console']['default']; |
63 | - return call_user_func_array($event,['args'=>$args,'app'=>$this->app]); |
|
63 | + return call_user_func_array($event, ['args'=>$args, 'app'=>$this->app]); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | //If the console executor is a custom console application; in this case we look at the kernel directory inside the application. |
80 | 80 | //If the console class is not available on the kernel of resta, then the system will run the command class in the application. |
81 | - return $this->checkConsoleNamespace(function(){ |
|
81 | + return $this->checkConsoleNamespace(function() { |
|
82 | 82 | |
83 | - if($this->isRunnableKernelCommandList()){ |
|
83 | + if ($this->isRunnableKernelCommandList()) { |
|
84 | 84 | exception()->badMethodCall('this command is not runnable'); |
85 | 85 | } |
86 | 86 | |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | $consoleArguments = $this->getConsoleArgumentsWithKey(); |
89 | 89 | |
90 | 90 | // we get the instance data of the kernel command class of the system. |
91 | - $commander = (new $this->consoleClassNamespace($consoleArguments,$this)); |
|
91 | + $commander = (new $this->consoleClassNamespace($consoleArguments, $this)); |
|
92 | 92 | |
93 | 93 | // we check the command rules of each command class. |
94 | - $this->prepareCommander($commander,function($commander){ |
|
94 | + $this->prepareCommander($commander, function($commander) { |
|
95 | 95 | return $commander->{$this->getConsoleClassMethod()}(); |
96 | 96 | }); |
97 | 97 | |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | public function handle() |
110 | 110 | { |
111 | 111 | //get is running console |
112 | - if($this->app->runningInConsole()){ |
|
112 | + if ($this->app->runningInConsole()) { |
|
113 | 113 | |
114 | 114 | //run console process |
115 | - if(count($this->getArguments())){ |
|
115 | + if (count($this->getArguments())) { |
|
116 | 116 | return $this->consoleProcess(); |
117 | 117 | } |
118 | 118 | |
@@ -128,23 +128,23 @@ discard block |
||
128 | 128 | * @param callable $callback |
129 | 129 | * @return mixed |
130 | 130 | */ |
131 | - protected function prepareCommander($commander,callable $callback) |
|
131 | + protected function prepareCommander($commander, callable $callback) |
|
132 | 132 | { |
133 | 133 | // closure binding custom command,move custom namespace as specific |
134 | 134 | // call prepare commander firstly for checking command builder |
135 | - $closureCommand = app()->resolve(ClosureDispatcher::class,['bind'=>$commander]); |
|
135 | + $closureCommand = app()->resolve(ClosureDispatcher::class, ['bind'=>$commander]); |
|
136 | 136 | |
137 | 137 | //assign commander method name |
138 | - $closureCommand->prepareBind['methodName']=$this->getConsoleClassMethod(); |
|
138 | + $closureCommand->prepareBind['methodName'] = $this->getConsoleClassMethod(); |
|
139 | 139 | $prepareCommander = $commander->prepareCommander($closureCommand); |
140 | 140 | |
141 | - if(!$prepareCommander['status']){ |
|
141 | + if (!$prepareCommander['status']) { |
|
142 | 142 | echo $commander->exception($prepareCommander); |
143 | 143 | die(); |
144 | 144 | } |
145 | 145 | |
146 | 146 | //callback custom console |
147 | - return call_user_func_array($callback,[$commander]); |
|
147 | + return call_user_func_array($callback, [$commander]); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | $commandList = $this->app->commandList(); |
158 | 158 | |
159 | 159 | //is runnable kernel command conditions |
160 | - return !array_key_exists($this->consoleClassNamespace,$commandList) OR |
|
161 | - (array_key_exists($this->consoleClassNamespace,$commandList) AND |
|
160 | + return !array_key_exists($this->consoleClassNamespace, $commandList) OR |
|
161 | + (array_key_exists($this->consoleClassNamespace, $commandList) AND |
|
162 | 162 | !$commandList[$this->consoleClassNamespace]['isRunnable']); |
163 | 163 | } |
164 | 164 | } |
165 | 165 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function getArguments() |
17 | 17 | { |
18 | 18 | //if there is no arguments constant |
19 | - if(!defined('arguments')) define ('arguments',['api']); |
|
19 | + if (!defined('arguments')) define('arguments', ['api']); |
|
20 | 20 | |
21 | 21 | //get psr standard console arguments |
22 | 22 | return core()->consoleArguments = Utils::upperCase(arguments); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function getConsoleClassRealArguments() |
51 | 51 | { |
52 | - return array_slice($this->getArguments(),2); |
|
52 | + return array_slice($this->getArguments(), 2); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -65,19 +65,19 @@ discard block |
||
65 | 65 | $listKey = []; |
66 | 66 | $listKey['project'] = null; |
67 | 67 | |
68 | - if(property_exists($this,'consoleClassNamespace')){ |
|
68 | + if (property_exists($this, 'consoleClassNamespace')) { |
|
69 | 69 | $listKey['class'] = strtolower(class_basename($this->consoleClassNamespace)); |
70 | 70 | $listKey['classMethod'] = strtolower($this->getConsoleClassMethod()); |
71 | 71 | } |
72 | 72 | |
73 | - foreach($getConsoleClassRealArguments as $key=>$value){ |
|
73 | + foreach ($getConsoleClassRealArguments as $key=>$value) { |
|
74 | 74 | |
75 | - if($key=="0"){ |
|
75 | + if ($key=="0") { |
|
76 | 76 | $listKey['project'] = $value; |
77 | 77 | } |
78 | - else{ |
|
78 | + else { |
|
79 | 79 | |
80 | - $colonExplode = explode(":",$value); |
|
80 | + $colonExplode = explode(":", $value); |
|
81 | 81 | $listKey[strtolower($colonExplode[0])] = ucfirst($colonExplode[1]); |
82 | 82 | } |
83 | 83 | } |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | |
110 | 110 | $this->getConsoleArgumentsWithKey(); |
111 | 111 | |
112 | - if(isset($arguments[2])){ |
|
112 | + if (isset($arguments[2])) { |
|
113 | 113 | $app = $arguments[2]; |
114 | 114 | } |
115 | 115 | |
116 | - if(!defined('group')){ |
|
117 | - define('group',StaticPathList::$projectPrefixGroup); |
|
116 | + if (!defined('group')) { |
|
117 | + define('group', StaticPathList::$projectPrefixGroup); |
|
118 | 118 | } |
119 | 119 | |
120 | - if(!defined('app') and isset($arguments[2])) define('app',isset($app) ?: null); |
|
120 | + if (!defined('app') and isset($arguments[2])) define('app', isset($app) ?: null); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | \ No newline at end of file |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | public function getArguments() |
17 | 17 | { |
18 | 18 | //if there is no arguments constant |
19 | - if(!defined('arguments')) define ('arguments',['api']); |
|
19 | + if(!defined('arguments')) { |
|
20 | + define ('arguments',['api']); |
|
21 | + } |
|
20 | 22 | |
21 | 23 | //get psr standard console arguments |
22 | 24 | return core()->consoleArguments = Utils::upperCase(arguments); |
@@ -74,8 +76,7 @@ discard block |
||
74 | 76 | |
75 | 77 | if($key=="0"){ |
76 | 78 | $listKey['project'] = $value; |
77 | - } |
|
78 | - else{ |
|
79 | + } else{ |
|
79 | 80 | |
80 | 81 | $colonExplode = explode(":",$value); |
81 | 82 | $listKey[strtolower($colonExplode[0])] = ucfirst($colonExplode[1]); |
@@ -117,6 +118,8 @@ discard block |
||
117 | 118 | define('group',StaticPathList::$projectPrefixGroup); |
118 | 119 | } |
119 | 120 | |
120 | - if(!defined('app') and isset($arguments[2])) define('app',isset($app) ?: null); |
|
121 | + if(!defined('app') and isset($arguments[2])) { |
|
122 | + define('app',isset($app) ?: null); |
|
123 | + } |
|
121 | 124 | } |
122 | 125 | } |
123 | 126 | \ No newline at end of file |