@@ -109,8 +109,9 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function name ($value = null) |
| 111 | 111 | { |
| 112 | - if (null === $value) |
|
| 113 | - return $this->name; |
|
| 112 | + if (null === $value) { |
|
| 113 | + return $this->name; |
|
| 114 | + } |
|
| 114 | 115 | |
| 115 | 116 | $this->name = $value; |
| 116 | 117 | return $this; |
@@ -124,8 +125,9 @@ discard block |
||
| 124 | 125 | */ |
| 125 | 126 | public function description ($value = null) |
| 126 | 127 | { |
| 127 | - if (null === $value) |
|
| 128 | - return $this->description; |
|
| 128 | + if (null === $value) { |
|
| 129 | + return $this->description; |
|
| 130 | + } |
|
| 129 | 131 | |
| 130 | 132 | $this->description = $value; |
| 131 | 133 | return $this; |
@@ -139,8 +141,9 @@ discard block |
||
| 139 | 141 | */ |
| 140 | 142 | public function version ($value = null) |
| 141 | 143 | { |
| 142 | - if (null === $value) |
|
| 143 | - return $this->version; |
|
| 144 | + if (null === $value) { |
|
| 145 | + return $this->version; |
|
| 146 | + } |
|
| 144 | 147 | |
| 145 | 148 | $this->version = $value; |
| 146 | 149 | return $this; |
@@ -154,8 +157,9 @@ discard block |
||
| 154 | 157 | */ |
| 155 | 158 | public function console ($value = null) |
| 156 | 159 | { |
| 157 | - if (null === $value) |
|
| 158 | - return $this->console; |
|
| 160 | + if (null === $value) { |
|
| 161 | + return $this->console; |
|
| 162 | + } |
|
| 159 | 163 | |
| 160 | 164 | $this->console = $value; |
| 161 | 165 | return $this; |
@@ -170,8 +174,9 @@ discard block |
||
| 170 | 174 | */ |
| 171 | 175 | public function syntax ($value = null) |
| 172 | 176 | { |
| 173 | - if (null === $value) |
|
| 174 | - return $this->syntaxBuilder->get(); |
|
| 177 | + if (null === $value) { |
|
| 178 | + return $this->syntaxBuilder->get(); |
|
| 179 | + } |
|
| 175 | 180 | |
| 176 | 181 | $this->syntaxBuilder = SyntaxBuilder::of($value); |
| 177 | 182 | |
@@ -218,8 +223,9 @@ discard block |
||
| 218 | 223 | public function command ($name, Command $cmd = null) |
| 219 | 224 | { |
| 220 | 225 | if (null === $cmd) { |
| 221 | - if (!$this->hasCommand($name)) |
|
| 222 | - throw new CommandNotFound("Command '{$name}' not found"); |
|
| 226 | + if (!$this->hasCommand($name)) { |
|
| 227 | + throw new CommandNotFound("Command '{$name}' not found"); |
|
| 228 | + } |
|
| 223 | 229 | return $this->subCommands[$name]; |
| 224 | 230 | } |
| 225 | 231 | |
@@ -245,8 +251,9 @@ discard block |
||
| 245 | 251 | */ |
| 246 | 252 | public function args($value = null) |
| 247 | 253 | { |
| 248 | - if (null === $value) |
|
| 249 | - return $this->args; |
|
| 254 | + if (null === $value) { |
|
| 255 | + return $this->args; |
|
| 256 | + } |
|
| 250 | 257 | |
| 251 | 258 | $this->args = $value; |
| 252 | 259 | return $this; |
@@ -306,10 +313,12 @@ discard block |
||
| 306 | 313 | { |
| 307 | 314 | try { |
| 308 | 315 | |
| 309 | - if (null === $args) |
|
| 310 | - $args = $this->consoleArguments(); |
|
| 311 | - if (null === $console) |
|
| 312 | - $console = new CLImate; |
|
| 316 | + if (null === $args) { |
|
| 317 | + $args = $this->consoleArguments(); |
|
| 318 | + } |
|
| 319 | + if (null === $console) { |
|
| 320 | + $console = new CLImate; |
|
| 321 | + } |
|
| 313 | 322 | |
| 314 | 323 | $firstArg = F\head(F\split(' ', $args)); |
| 315 | 324 | if ($this->hasCommand($firstArg)) { |
@@ -323,11 +332,10 @@ discard block |
||
| 323 | 332 | ->then(F\join(PHP_EOL)) |
| 324 | 333 | ->get(); |
| 325 | 334 | $this->error($errors); |
| 326 | - } |
|
| 327 | - |
|
| 328 | - else |
|
| 329 | - $this->args($this->syntax()->parse($args)) |
|
| 335 | + } else { |
|
| 336 | + $this->args($this->syntax()->parse($args)) |
|
| 330 | 337 | ->execute(); |
| 338 | + } |
|
| 331 | 339 | } |
| 332 | 340 | } catch (\Exception $e) { |
| 333 | 341 | $this->error( |
@@ -346,8 +354,9 @@ discard block |
||
| 346 | 354 | */ |
| 347 | 355 | protected function template($name) |
| 348 | 356 | { |
| 349 | - if (null === $this->templateLoader) |
|
| 350 | - throw new NullPropertyAccess("The templatesLoader is not initialized; Please set it before trying to load a template !"); |
|
| 357 | + if (null === $this->templateLoader) { |
|
| 358 | + throw new NullPropertyAccess("The templatesLoader is not initialized; Please set it before trying to load a template !"); |
|
| 359 | + } |
|
| 351 | 360 | |
| 352 | 361 | return $this->templateLoader->load($name); |
| 353 | 362 | } |
@@ -75,8 +75,9 @@ |
||
| 75 | 75 | |
| 76 | 76 | $ss = S::syntax(); |
| 77 | 77 | |
| 78 | - if (!$ss->canParse($syntax)) |
|
| 79 | - throw new SyntaxBuilderException("Invalid Syntax: '{$syntax}'"); |
|
| 78 | + if (!$ss->canParse($syntax)) { |
|
| 79 | + throw new SyntaxBuilderException("Invalid Syntax: '{$syntax}'"); |
|
| 80 | + } |
|
| 80 | 81 | |
| 81 | 82 | return $ss->parse($syntax); |
| 82 | 83 | } |
@@ -24,10 +24,11 @@ |
||
| 24 | 24 | protected function execute () |
| 25 | 25 | { |
| 26 | 26 | $command = trim($this->args->command); |
| 27 | - if (empty($command) || !$this->parent()->hasCommand($command)) |
|
| 28 | - $this->showHelpOf($this->parent); |
|
| 29 | - else |
|
| 30 | - $this->showHelpOf($this->parent->command($command)); |
|
| 27 | + if (empty($command) || !$this->parent()->hasCommand($command)) { |
|
| 28 | + $this->showHelpOf($this->parent); |
|
| 29 | + } else { |
|
| 30 | + $this->showHelpOf($this->parent->command($command)); |
|
| 31 | + } |
|
| 31 | 32 | } |
| 32 | 33 | |
| 33 | 34 | protected function showHelpOf (Command $command) |
@@ -63,8 +63,9 @@ |
||
| 63 | 63 | */ |
| 64 | 64 | public function fs (Filesystem $value = null) |
| 65 | 65 | { |
| 66 | - if (null === $value) |
|
| 67 | - return $this->fs; |
|
| 66 | + if (null === $value) { |
|
| 67 | + return $this->fs; |
|
| 68 | + } |
|
| 68 | 69 | $this->fs = $value; |
| 69 | 70 | return $this; |
| 70 | 71 | } |