@@ -9,54 +9,54 @@ |
||
| 9 | 9 | public function test_it_repeats_word_three_times() |
| 10 | 10 | { |
| 11 | 11 | $this->command(new RepeatCommand, ['foo']) |
| 12 | - ->argsEqual((object) [ |
|
| 12 | + ->argsEqual((object) [ |
|
| 13 | 13 | 'word' => 'foo', |
| 14 | 14 | 'count' => 3 |
| 15 | - ]) |
|
| 16 | - ->optionsEqual([ |
|
| 15 | + ]) |
|
| 16 | + ->optionsEqual([ |
|
| 17 | 17 | '--upper' => false |
| 18 | - ]) |
|
| 19 | - ->printsExactly("foofoofoo<br>"); |
|
| 18 | + ]) |
|
| 19 | + ->printsExactly("foofoofoo<br>"); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function test_it_repeats_word_n_times() |
| 23 | 23 | { |
| 24 | 24 | $this->command(new RepeatCommand, ['bar', '5']) |
| 25 | - ->argsEqual((object) [ |
|
| 25 | + ->argsEqual((object) [ |
|
| 26 | 26 | 'word' => 'bar', |
| 27 | 27 | 'count' => 5 |
| 28 | - ]) |
|
| 29 | - ->optionsEqual([ |
|
| 28 | + ]) |
|
| 29 | + ->optionsEqual([ |
|
| 30 | 30 | '--upper' => false |
| 31 | - ]) |
|
| 32 | - ->printsExactly("barbarbarbarbar<br>"); |
|
| 31 | + ]) |
|
| 32 | + ->printsExactly("barbarbarbarbar<br>"); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function test_it_repeats_word_n_times_uppercase() |
| 36 | 36 | { |
| 37 | 37 | $this->command(new RepeatCommand, ['bar', '5', '--upper']) |
| 38 | - ->argsEqual((object) [ |
|
| 39 | - 'word' => 'bar', |
|
| 40 | - 'count' => 5 |
|
| 41 | - ]) |
|
| 42 | - ->optionsEqual([ |
|
| 43 | - '--upper' => true |
|
| 44 | - ]) |
|
| 45 | - ->printsExactly("BARBARBARBARBAR<br>"); |
|
| 38 | + ->argsEqual((object) [ |
|
| 39 | + 'word' => 'bar', |
|
| 40 | + 'count' => 5 |
|
| 41 | + ]) |
|
| 42 | + ->optionsEqual([ |
|
| 43 | + '--upper' => true |
|
| 44 | + ]) |
|
| 45 | + ->printsExactly("BARBARBARBARBAR<br>"); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function test_it_runs_interatively() |
| 49 | 49 | { |
| 50 | 50 | $this->withStdin("Yo\n\n\n") |
| 51 | - ->command(new RepeatCommand, ['-i']) |
|
| 52 | - ->argsEqual((object) [ |
|
| 53 | - 'word' => 'Yo', |
|
| 54 | - 'count' => 3 |
|
| 55 | - ]) |
|
| 56 | - ->optionsEqual([ |
|
| 57 | - '--upper' => false |
|
| 58 | - ]) |
|
| 59 | - ->prints("YoYoYo<br>"); |
|
| 51 | + ->command(new RepeatCommand, ['-i']) |
|
| 52 | + ->argsEqual((object) [ |
|
| 53 | + 'word' => 'Yo', |
|
| 54 | + 'count' => 3 |
|
| 55 | + ]) |
|
| 56 | + ->optionsEqual([ |
|
| 57 | + '--upper' => false |
|
| 58 | + ]) |
|
| 59 | + ->prints("YoYoYo<br>"); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | } |
@@ -44,15 +44,15 @@ discard block |
||
| 44 | 44 | public function __construct() |
| 45 | 45 | { |
| 46 | 46 | $this->commands([]) |
| 47 | - ->name('Unknown') |
|
| 48 | - ->version('1.0.0') |
|
| 49 | - ->description('...') |
|
| 50 | - ->descriptions([]) |
|
| 51 | - ->options([]) |
|
| 52 | - ->console(new Console) |
|
| 53 | - ->fs(new Filesystem('.')) |
|
| 54 | - ->setupSubCommands() |
|
| 55 | - ->init(); |
|
| 47 | + ->name('Unknown') |
|
| 48 | + ->version('1.0.0') |
|
| 49 | + ->description('...') |
|
| 50 | + ->descriptions([]) |
|
| 51 | + ->options([]) |
|
| 52 | + ->console(new Console) |
|
| 53 | + ->fs(new Filesystem('.')) |
|
| 54 | + ->setupSubCommands() |
|
| 55 | + ->init(); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -299,8 +299,8 @@ discard block |
||
| 299 | 299 | protected function setupSubCommands() |
| 300 | 300 | { |
| 301 | 301 | return $this->command('--help', new HelpCommand($this)) |
| 302 | - ->command('--version', new VersionCommand($this)) |
|
| 303 | - ->command('-i', new InteractiveCommand($this)); |
|
| 302 | + ->command('--version', new VersionCommand($this)) |
|
| 303 | + ->command('-i', new InteractiveCommand($this)); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | public function describe(string $name, string $description = null) |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $this->options = []; |
| 146 | - foreach($options as $option) |
|
| 146 | + foreach ($options as $option) |
|
| 147 | 147 | $this->options[$option] = false; |
| 148 | 148 | |
| 149 | 149 | return $this; |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | protected function clear() |
| 366 | 366 | { |
| 367 | 367 | $this->args = null; |
| 368 | - foreach($this->options as $name => $value) { |
|
| 368 | + foreach ($this->options as $name => $value) { |
|
| 369 | 369 | $this->options[$name] = false; |
| 370 | 370 | } |
| 371 | 371 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | protected function init() |
| 27 | 27 | { |
| 28 | 28 | $this->name('Interactive') |
| 29 | - ->description('Reads the command arguments and options interactively.'); |
|
| 29 | + ->description('Reads the command arguments and options interactively.'); |
|
| 30 | 30 | $this->helper = SyntaxHelper::instance(); |
| 31 | 31 | $this->confirmSyntax = S::optional(S::boolean(), false); |
| 32 | 32 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $description = $this->parent->describe($name); |
| 99 | 99 | $this->console->out( |
| 100 | 100 | "<success>{$name}</success> <warn>{$text}</warn>" |
| 101 | - . " {$description} <warn>{$default}</warn><br>" |
|
| 101 | + . " {$description} <warn>{$default}</warn><br>" |
|
| 102 | 102 | ); |
| 103 | 103 | } |
| 104 | 104 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | $options = array_keys($parent->options()); |
| 46 | 46 | $chosen = []; |
| 47 | - foreach($options as $option) { |
|
| 47 | + foreach ($options as $option) { |
|
| 48 | 48 | $description = $parent->describe($option); |
| 49 | 49 | $bool = $this->read($this->confirmSyntax, $option, true); |
| 50 | 50 | $parent->options[$option] = $bool; |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | $done = false; |
| 145 | 145 | $text = ''; |
| 146 | 146 | $result = null; |
| 147 | - while (! $done) { |
|
| 147 | + while (!$done) { |
|
| 148 | 148 | $c = $this->readChar(); |
| 149 | - switch($c) { |
|
| 149 | + switch ($c) { |
|
| 150 | 150 | case 'enter': |
| 151 | 151 | $done = true; |
| 152 | 152 | break; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | protected function init() |
| 15 | 15 | { |
| 16 | 16 | $this->name('Help') |
| 17 | - ->description('Shows the help message.'); |
|
| 17 | + ->description('Shows the help message.'); |
|
| 18 | 18 | $this->helper = SyntaxHelper::instance(); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | $parent = $this->parent; |
| 24 | 24 | |
| 25 | 25 | $text = "<info>{$parent->name}</info> version <info>{$parent->version}</info>" |
| 26 | - . "<br><br>{$parent->description}<br><br>" |
|
| 27 | - . $this->syntaxHelp() |
|
| 28 | - . $this->optionsHelp() |
|
| 29 | - . $this->subCommandsHelp(); |
|
| 26 | + . "<br><br>{$parent->description}<br><br>" |
|
| 27 | + . $this->syntaxHelp() |
|
| 28 | + . $this->optionsHelp() |
|
| 29 | + . $this->subCommandsHelp(); |
|
| 30 | 30 | |
| 31 | 31 | $this->console()->out($text); |
| 32 | 32 | } |
@@ -88,11 +88,11 @@ |
||
| 88 | 88 | $default = 'default: ' . json_encode($s->getDefault()); |
| 89 | 89 | else |
| 90 | 90 | $default = 'required'; |
| 91 | - $description = $this->parent()->describe($prefix.$name); |
|
| 91 | + $description = $this->parent()->describe($prefix . $name); |
|
| 92 | 92 | $syntax = $this->helper->asString($s); |
| 93 | 93 | $text = "{$tabs}<warn>{$name}</warn> <success>{$syntax}</success>" |
| 94 | 94 | . " {$description} <info>({$default})</info><br>"; |
| 95 | - $level ++; |
|
| 95 | + $level++; |
|
| 96 | 96 | $prefix .= $name . '.'; |
| 97 | 97 | foreach ($this->helper->fields($s) as $field => $syntax) { |
| 98 | 98 | $text .= $this->fieldHelp($field, $syntax, $prefix, $level); |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | protected function init() |
| 8 | 8 | { |
| 9 | 9 | $this->name('Version') |
| 10 | - ->description('Shows the version.'); |
|
| 10 | + ->description('Shows the version.'); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | protected function execute() |