@@ -14,6 +14,6 @@ |
||
14 | 14 | * @param array $commander |
15 | 15 | * @return mixed |
16 | 16 | */ |
17 | - public function exception($commander=array()); |
|
17 | + public function exception($commander = array()); |
|
18 | 18 | |
19 | 19 | } |
20 | 20 | \ No newline at end of file |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | { |
28 | 28 | // we check that they are in |
29 | 29 | // the console to run the console commands in the kernel. |
30 | - if(Utils::isNamespaceExists($this->consoleClassNamespace)){ |
|
30 | + if (Utils::isNamespaceExists($this->consoleClassNamespace)) { |
|
31 | 31 | return call_user_func($callback); |
32 | 32 | } |
33 | 33 | |
34 | 34 | // if the kernel console is not found |
35 | 35 | // then we check the existence of the specific application command and run it if it is. |
36 | - return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(),$this))->handle(); |
|
36 | + return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(), $this))->handle(); |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | |
@@ -43,25 +43,25 @@ discard block |
||
43 | 43 | * @param array $args |
44 | 44 | * @return void|mixed |
45 | 45 | */ |
46 | - protected function consoleEventHandler($args=array()) |
|
46 | + protected function consoleEventHandler($args = array()) |
|
47 | 47 | { |
48 | - if(isset($this->app['eventDispatcher'])){ |
|
48 | + if (isset($this->app['eventDispatcher'])) { |
|
49 | 49 | |
50 | 50 | $listeners = event()->getListeners(); |
51 | 51 | |
52 | - if(isset($args['event']) && isset($listeners['console'])){ |
|
52 | + if (isset($args['event']) && isset($listeners['console'])) { |
|
53 | 53 | |
54 | - if(strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])){ |
|
54 | + if (strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])) { |
|
55 | 55 | |
56 | 56 | $event = $listeners['console'][strtolower($args['event'])]; |
57 | - return call_user_func_array($event,['app'=>$this->app,'args'=>$args,]); |
|
57 | + return call_user_func_array($event, ['app'=>$this->app, 'args'=>$args, ]); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - if(isset($listeners['console']['default'])){ |
|
61 | + if (isset($listeners['console']['default'])) { |
|
62 | 62 | |
63 | 63 | $event = $listeners['console']['default']; |
64 | - return call_user_func_array($event,['args'=>$args,'app'=>$this->app]); |
|
64 | + return call_user_func_array($event, ['args'=>$args, 'app'=>$this->app]); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | |
80 | 80 | //If the console executor is a custom console application; in this case we look at the kernel directory inside the application. |
81 | 81 | //If the console class is not available on the kernel of resta, then the system will run the command class in the application. |
82 | - return $this->checkConsoleNamespace(function(){ |
|
82 | + return $this->checkConsoleNamespace(function() { |
|
83 | 83 | |
84 | - if($this->isRunnableKernelCommandList()){ |
|
84 | + if ($this->isRunnableKernelCommandList()) { |
|
85 | 85 | exception()->badMethodCall('this command is not runnable'); |
86 | 86 | } |
87 | 87 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | $consoleArguments = $this->getConsoleArgumentsWithKey(); |
90 | 90 | |
91 | 91 | // we get the instance data of the kernel command class of the system. |
92 | - $commander = (new $this->consoleClassNamespace($consoleArguments,$this)); |
|
92 | + $commander = (new $this->consoleClassNamespace($consoleArguments, $this)); |
|
93 | 93 | |
94 | 94 | // we check the command rules of each command class. |
95 | - $this->prepareCommander($commander,function($commander){ |
|
95 | + $this->prepareCommander($commander, function($commander) { |
|
96 | 96 | return $commander->{$this->getConsoleClassMethod()}(); |
97 | 97 | }); |
98 | 98 | |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | public function handle() |
111 | 111 | { |
112 | 112 | //get is running console |
113 | - if($this->app->runningInConsole()){ |
|
113 | + if ($this->app->runningInConsole()) { |
|
114 | 114 | |
115 | 115 | //run console process |
116 | - if(count($this->getArguments())){ |
|
116 | + if (count($this->getArguments())) { |
|
117 | 117 | return $this->consoleProcess(); |
118 | 118 | } |
119 | 119 | |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | * @param callable $callback |
130 | 130 | * @return mixed |
131 | 131 | */ |
132 | - protected function prepareCommander(ConsoleOutputterContracts $commander,callable $callback) |
|
132 | + protected function prepareCommander(ConsoleOutputterContracts $commander, callable $callback) |
|
133 | 133 | { |
134 | 134 | // closure binding custom command,move custom namespace as specific |
135 | 135 | // call prepare commander firstly for checking command builder |
136 | - $closureCommand = app()->resolve(ClosureDispatcher::class,['bind'=>$commander]); |
|
136 | + $closureCommand = app()->resolve(ClosureDispatcher::class, ['bind'=>$commander]); |
|
137 | 137 | |
138 | 138 | //assign commander method name |
139 | 139 | $closureCommand->prepareBind['methodName'] = $this->getConsoleClassMethod(); |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | dd($commander); |
142 | 142 | $prepareCommander = $commander->prepareCommander($closureCommand); |
143 | 143 | |
144 | - if(!$prepareCommander['status']){ |
|
144 | + if (!$prepareCommander['status']) { |
|
145 | 145 | echo $commander->exception($prepareCommander); |
146 | 146 | die(); |
147 | 147 | } |
148 | 148 | |
149 | 149 | //callback custom console |
150 | - return call_user_func_array($callback,[$commander]); |
|
150 | + return call_user_func_array($callback, [$commander]); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | $commandList = $this->app->commandList(); |
161 | 161 | |
162 | 162 | //is runnable kernel command conditions |
163 | - return !array_key_exists($this->consoleClassNamespace,$commandList) OR |
|
164 | - (array_key_exists($this->consoleClassNamespace,$commandList) AND |
|
163 | + return !array_key_exists($this->consoleClassNamespace, $commandList) OR |
|
164 | + (array_key_exists($this->consoleClassNamespace, $commandList) AND |
|
165 | 165 | !$commandList[$this->consoleClassNamespace]['isRunnable']); |
166 | 166 | } |
167 | 167 | } |
168 | 168 | \ No newline at end of file |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param $argument |
64 | 64 | * @param $app |
65 | 65 | */ |
66 | - public function __construct($argument,$app) { |
|
66 | + public function __construct($argument, $app) { |
|
67 | 67 | |
68 | 68 | // Set up shell colors |
69 | 69 | $this->foreground_colors['black'] = '0;30'; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $this->table = new \console_table(); |
100 | 100 | |
101 | 101 | |
102 | - if(isset($this->argument['project'])){ |
|
102 | + if (isset($this->argument['project'])) { |
|
103 | 103 | |
104 | 104 | $this->argument['repositoryNamespace'] = app()->namespace()->repository(); |
105 | 105 | $this->argument['modelNamespace'] = app()->namespace()->model(); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $this->argument['project'] = $this->argument['project'].'\\'.StaticPathList::$projectPrefixGroup; |
111 | 111 | |
112 | 112 | |
113 | - $this->project = StaticPathModel::appPath().'/'.str_replace('\\','/',$this->argument['project']); |
|
113 | + $this->project = StaticPathModel::appPath().'/'.str_replace('\\', '/', $this->argument['project']); |
|
114 | 114 | |
115 | 115 | |
116 | 116 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | return array_keys($this->background_colors); |
128 | 128 | } |
129 | 129 | |
130 | - public function ReadStdin($prompt=null, $valid_inputs=null, $default = '') { |
|
131 | - while(!isset($input) || (is_array($valid_inputs) && !in_array($input, $valid_inputs)) || ($valid_inputs == 'is_file' && !is_file($input))) { |
|
130 | + public function ReadStdin($prompt = null, $valid_inputs = null, $default = '') { |
|
131 | + while (!isset($input) || (is_array($valid_inputs) && !in_array($input, $valid_inputs)) || ($valid_inputs=='is_file' && !is_file($input))) { |
|
132 | 132 | echo $this->input($prompt); |
133 | 133 | $input = strtolower(trim(fgets(STDIN))); |
134 | - if(empty($input) && !empty($default)) { |
|
134 | + if (empty($input) && !empty($default)) { |
|
135 | 135 | $input = $default; |
136 | 136 | } |
137 | 137 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param array $commander |
143 | 143 | * @return mixed|string |
144 | 144 | */ |
145 | - public function exception($commander=array()){ |
|
145 | + public function exception($commander = array()) { |
|
146 | 146 | return $this->error('[['.$commander['argument'].']] parameter is missing for commander'); |
147 | 147 | } |
148 | 148 | |
@@ -151,15 +151,15 @@ discard block |
||
151 | 151 | * @param string $seperate |
152 | 152 | * @return mixed|string |
153 | 153 | */ |
154 | - public function checkGroupArgument($data,$seperate="\\"){ |
|
154 | + public function checkGroupArgument($data, $seperate = "\\") { |
|
155 | 155 | |
156 | - $dataParse=explode("\\",$data); |
|
156 | + $dataParse = explode("\\", $data); |
|
157 | 157 | |
158 | - if(isset($this->argument['group'])){ |
|
159 | - $argument=current($dataParse).''.$seperate.''.$this->argument['group']; |
|
158 | + if (isset($this->argument['group'])) { |
|
159 | + $argument = current($dataParse).''.$seperate.''.$this->argument['group']; |
|
160 | 160 | } |
161 | - else{ |
|
162 | - $argument=current($dataParse); |
|
161 | + else { |
|
162 | + $argument = current($dataParse); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | return $argument; |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | /** |
169 | 169 | * @param $string |
170 | 170 | */ |
171 | - public function consoleLogger($string,$level) |
|
171 | + public function consoleLogger($string, $level) |
|
172 | 172 | { |
173 | - if(config('app')!==null && config('app.consoleLogger')){ |
|
173 | + if (config('app')!==null && config('app.consoleLogger')) { |
|
174 | 174 | |
175 | 175 | logger('console')->{$level}([ |
176 | - 'argument' => implode(" ",core()->consoleArguments), |
|
176 | + 'argument' => implode(" ", core()->consoleArguments), |
|
177 | 177 | 'result' => $string, |
178 | 178 | ]); |
179 | 179 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function prepareCommander($commander) |
21 | 21 | { |
22 | - $commander=$commander->call(function() use($commander){ |
|
22 | + $commander = $commander->call(function() use($commander){ |
|
23 | 23 | |
24 | 24 | return [ |
25 | 25 | 'commandRule' => $this->commandRule, |
@@ -37,16 +37,15 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function resolveParameters($commander) |
39 | 39 | { |
40 | - if(isset($commander['commandRule'][$commander['method']])){ |
|
41 | - $methodCommanderRule = $commander['commandRule'][$commander['method']]; |
|
40 | + if (isset($commander['commandRule'][$commander['method']])) { |
|
41 | + $methodCommanderRule = $commander['commandRule'][$commander['method']]; |
|
42 | 42 | } |
43 | 43 | |
44 | - $commandRule = (isset($methodCommanderRule)) ? $methodCommanderRule : |
|
45 | - $this->getDefaultCommandRules($commander['commandRule']); |
|
44 | + $commandRule = (isset($methodCommanderRule)) ? $methodCommanderRule : $this->getDefaultCommandRules($commander['commandRule']); |
|
46 | 45 | |
47 | - foreach ($commandRule as $key=>$value){ |
|
48 | - if(!preg_match('@\?.+@is',$value)){ |
|
49 | - if(!isset($commander['arguments'][$value]) OR $commander['arguments'][$value]==""){ |
|
46 | + foreach ($commandRule as $key=>$value) { |
|
47 | + if (!preg_match('@\?.+@is', $value)) { |
|
48 | + if (!isset($commander['arguments'][$value]) OR $commander['arguments'][$value]=="") { |
|
50 | 49 | return [ |
51 | 50 | 'status'=>false, |
52 | 51 | 'argument'=>$value, |
@@ -68,12 +67,12 @@ discard block |
||
68 | 67 | { |
69 | 68 | $list = []; |
70 | 69 | |
71 | - if(!is_array($rules)) $rules = []; |
|
70 | + if (!is_array($rules)) $rules = []; |
|
72 | 71 | |
73 | - foreach ($rules as $key=>$rule){ |
|
72 | + foreach ($rules as $key=>$rule) { |
|
74 | 73 | |
75 | - if(!is_array($rules[$key])){ |
|
76 | - $list[$key]=$rule; |
|
74 | + if (!is_array($rules[$key])) { |
|
75 | + $list[$key] = $rule; |
|
77 | 76 | } |
78 | 77 | } |
79 | 78 |