@@ -104,17 +104,17 @@ discard block |
||
| 104 | 104 | $this->commandName = implode('/', array_map('strtolower', explode('/', $className))); |
| 105 | 105 | |
| 106 | 106 | foreach ($this->commandOptions as $optionName => $optionConfig) { |
| 107 | - $shortcut = empty($optionConfig[ 'shortcut' ]) |
|
| 107 | + $shortcut = empty($optionConfig['shortcut']) |
|
| 108 | 108 | ? '-' . substr($optionName, 0, 1) |
| 109 | - : '-' . rtrim($optionConfig[ 'shortcut' ]); |
|
| 109 | + : '-' . rtrim($optionConfig['shortcut']); |
|
| 110 | 110 | |
| 111 | 111 | if (array_key_exists($shortcut, $this->commandOptionsShortcuts)) { |
| 112 | 112 | $shortcut = '-' . substr($optionName, 0, 2); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $this->commandOptions[ $optionName ][ 'shortcut' ] = $shortcut; |
|
| 115 | + $this->commandOptions[$optionName]['shortcut'] = $shortcut; |
|
| 116 | 116 | |
| 117 | - $this->commandOptionsShortcuts[ $shortcut ] = $optionName; |
|
| 117 | + $this->commandOptionsShortcuts[$shortcut] = $optionName; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | if (array_key_exists('VERBOSE', $_ENV)) { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | ? '-' . substr($optionName, 0, 1) |
| 162 | 162 | : '-' . rtrim($optionShortcut); |
| 163 | 163 | |
| 164 | - $this->commandOptions[ $optionName ] = [ |
|
| 164 | + $this->commandOptions[$optionName] = [ |
|
| 165 | 165 | 'shortcut' => $optionShortcut, |
| 166 | 166 | 'description' => $optionDescription, |
| 167 | 167 | ]; |
@@ -202,27 +202,27 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | protected function __callOptions() |
| 204 | 204 | { |
| 205 | - if(false !== ($options = input()->get())) { |
|
| 206 | - if(count($options)) { |
|
| 205 | + if (false !== ($options = input()->get())) { |
|
| 206 | + if (count($options)) { |
|
| 207 | 207 | $command = new \ReflectionClass($this); |
| 208 | 208 | |
| 209 | 209 | foreach ($options as $method => $arguments) { |
| 210 | 210 | |
| 211 | 211 | if (array_key_exists('-' . $method, $this->commandOptionsShortcuts)) { |
| 212 | - $method = $this->commandOptionsShortcuts[ '-' . $method ]; |
|
| 212 | + $method = $this->commandOptionsShortcuts['-' . $method]; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | if ( ! $command->hasMethod($optionMethod = camelcase('option-' . $method))) { |
| 216 | 216 | $commandMethod = $command->getMethod($optionMethod); |
| 217 | - } elseif($command->hasMethod($optionMethod = camelcase($method))) { |
|
| 217 | + } elseif ($command->hasMethod($optionMethod = camelcase($method))) { |
|
| 218 | 218 | $commandMethod = $command->getMethod($optionMethod); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - if($commandMethod instanceof \ReflectionMethod) { |
|
| 221 | + if ($commandMethod instanceof \ReflectionMethod) { |
|
| 222 | 222 | if ($commandMethod->getNumberOfRequiredParameters() == 0) { |
| 223 | 223 | call_user_func_array([&$this, $optionMethod], [$arguments]); |
| 224 | 224 | } elseif ($commandMethod->getNumberOfRequiredParameters() > 0 and empty($arguments)) { |
| 225 | - if (isset($this->commandOptions[ $method ][ 'help' ])) { |
|
| 225 | + if (isset($this->commandOptions[$method]['help'])) { |
|
| 226 | 226 | output()->write( |
| 227 | 227 | (new Format()) |
| 228 | 228 | ->setContextualClass(Format::INFO) |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | output()->write( |
| 235 | 235 | (new Format()) |
| 236 | 236 | ->setContextualClass(Format::INFO) |
| 237 | - ->setString(language()->getLine($this->commandOptions[ $method ][ 'help' ])) |
|
| 237 | + ->setString(language()->getLine($this->commandOptions[$method]['help'])) |
|
| 238 | 238 | ->setNewLinesAfter(2) |
| 239 | 239 | ); |
| 240 | 240 | } |
@@ -348,8 +348,8 @@ discard block |
||
| 348 | 348 | $table |
| 349 | 349 | ->addRow() |
| 350 | 350 | ->addColumn('--' . $optionCaller) |
| 351 | - ->addColumn($optionProps[ 'shortcut' ]) |
|
| 352 | - ->addColumn(language()->getLine($optionProps[ 'description' ])); |
|
| 351 | + ->addColumn($optionProps['shortcut']) |
|
| 352 | + ->addColumn(language()->getLine($optionProps['description'])); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | output()->write( |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | public function addCommander(AbstractCommander $commander) |
| 401 | 401 | { |
| 402 | - $this->actionsPool[ $commander->getCommandName() ] = $commander; |
|
| 402 | + $this->actionsPool[$commander->getCommandName()] = $commander; |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | // ------------------------------------------------------------------------ |