@@ -360,9 +360,9 @@ |
||
| 360 | 360 | : ['pipe', 'w']; |
| 361 | 361 | |
| 362 | 362 | return [ |
| 363 | - self::STDIN_DESCRIPTOR => ['pipe', 'r'], |
|
| 364 | - self::STDOUT_DESCRIPTOR => $out, |
|
| 365 | - self::STDERR_DESCRIPTOR => $out, |
|
| 363 | + self::STDIN_DESCRIPTOR => ['pipe', 'r'], |
|
| 364 | + self::STDOUT_DESCRIPTOR => $out, |
|
| 365 | + self::STDERR_DESCRIPTOR => $out, |
|
| 366 | 366 | ]; |
| 367 | 367 | } |
| 368 | 368 | |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * @class Shell |
| 55 | 55 | * @package Platine\Console\Command |
| 56 | 56 | */ |
| 57 | -class Shell |
|
| 58 | -{ |
|
| 57 | +class Shell { |
|
| 59 | 58 | public const STDIN_DESCRIPTOR = 0; |
| 60 | 59 | public const STDOUT_DESCRIPTOR = 1; |
| 61 | 60 | public const STDERR_DESCRIPTOR = 2; |
@@ -152,8 +151,7 @@ discard block |
||
| 152 | 151 | /** |
| 153 | 152 | * Create new instance |
| 154 | 153 | */ |
| 155 | - public function __construct() |
|
| 156 | - { |
|
| 154 | + public function __construct() { |
|
| 157 | 155 | if (!function_exists('proc_open')) { |
| 158 | 156 | throw new RuntimeException( |
| 159 | 157 | 'The "proc_open" could not be found in your PHP setup' |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | }; |
| 130 | 130 | |
| 131 | 131 | $this->command('__default__', 'Default command', '', true, true) |
| 132 | - ->on([$this, 'showHelp'], 'help'); |
|
| 132 | + ->on([$this, 'showHelp'], 'help'); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | * @class Application |
| 60 | 60 | * @package Platine\Console |
| 61 | 61 | */ |
| 62 | -class Application |
|
| 63 | -{ |
|
| 62 | +class Application { |
|
| 64 | 63 | /** |
| 65 | 64 | * List of commands |
| 66 | 65 | * @var Command[] |
@@ -339,8 +338,7 @@ discard block |
||
| 339 | 338 | * @param array<int, string> $argv |
| 340 | 339 | * @return mixed |
| 341 | 340 | */ |
| 342 | - public function handle(array $argv) |
|
| 343 | - { |
|
| 341 | + public function handle(array $argv) { |
|
| 344 | 342 | if (count($argv) < 2) { |
| 345 | 343 | return $this->showHelp(); |
| 346 | 344 | } |
@@ -61,10 +61,10 @@ |
||
| 61 | 61 | */ |
| 62 | 62 | protected string $short = ''; |
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * The long option name |
|
| 66 | - * @var string |
|
| 67 | - */ |
|
| 64 | + /** |
|
| 65 | + * The long option name |
|
| 66 | + * @var string |
|
| 67 | + */ |
|
| 68 | 68 | protected string $long = ''; |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * @class Option |
| 53 | 53 | * @package Platine\Console\Input |
| 54 | 54 | */ |
| 55 | -class Option extends Parameter |
|
| 56 | -{ |
|
| 55 | +class Option extends Parameter { |
|
| 57 | 56 | /** |
| 58 | 57 | * The short option name |
| 59 | 58 | * @var string |
@@ -248,9 +248,9 @@ |
||
| 248 | 248 | |
| 249 | 249 | foreach ($choices as $choice => $desc) { |
| 250 | 250 | $this->writer->eol() |
| 251 | - ->cyan( |
|
| 252 | - str_pad(' [' . $choice . ']', $maxLength + 6) |
|
| 253 | - ); |
|
| 251 | + ->cyan( |
|
| 252 | + str_pad(' [' . $choice . ']', $maxLength + 6) |
|
| 253 | + ); |
|
| 254 | 254 | |
| 255 | 255 | $this->writer->dim($desc); |
| 256 | 256 | } |
@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | * @class Interactor |
| 58 | 58 | * @package Platine\Console\IO |
| 59 | 59 | */ |
| 60 | -class Interactor |
|
| 61 | -{ |
|
| 60 | +class Interactor { |
|
| 62 | 61 | /** |
| 63 | 62 | * Stream reader instance |
| 64 | 63 | * @var Reader |
@@ -76,8 +75,7 @@ discard block |
||
| 76 | 75 | * @param string|null $input |
| 77 | 76 | * @param string|null $output |
| 78 | 77 | */ |
| 79 | - public function __construct(?string $input = null, ?string $output = null) |
|
| 80 | - { |
|
| 78 | + public function __construct(?string $input = null, ?string $output = null) { |
|
| 81 | 79 | $this->reader = new Reader($input); |
| 82 | 80 | $this->writer = new Writer($output); |
| 83 | 81 | } |
@@ -578,17 +578,17 @@ |
||
| 578 | 578 | protected function defaults(): self |
| 579 | 579 | { |
| 580 | 580 | $this->addOption('-h|--help', 'Show help') |
| 581 | - ->on([$this, 'showHelp']); |
|
| 581 | + ->on([$this, 'showHelp']); |
|
| 582 | 582 | |
| 583 | 583 | $this->addOption('-v|--version', 'Show version') |
| 584 | - ->on([$this, 'showVersion']); |
|
| 584 | + ->on([$this, 'showVersion']); |
|
| 585 | 585 | |
| 586 | 586 | $this->addOption('-V|--verbosity', 'Verbosity level', 0) |
| 587 | - ->on(function () { |
|
| 587 | + ->on(function () { |
|
| 588 | 588 | $this->set('verbosity', ++$this->verbosity); |
| 589 | 589 | |
| 590 | 590 | return false; |
| 591 | - }); |
|
| 591 | + }); |
|
| 592 | 592 | |
| 593 | 593 | $this->onExit(function (int $exitCode = 0) { |
| 594 | 594 | $this->terminate($exitCode); |
@@ -64,8 +64,7 @@ |
||
| 64 | 64 | * @class Command |
| 65 | 65 | * @package Platine\Console\Command |
| 66 | 66 | */ |
| 67 | -class Command extends Parser |
|
| 68 | -{ |
|
| 67 | +class Command extends Parser { |
|
| 69 | 68 | /** |
| 70 | 69 | * The command version |
| 71 | 70 | * @var string |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * @class Cursor |
| 53 | 53 | * @package Platine\Console\Output |
| 54 | 54 | */ |
| 55 | -class Cursor |
|
| 56 | -{ |
|
| 55 | +class Cursor { |
|
| 57 | 56 | /** |
| 58 | 57 | * Returns signal to move cursor up "count" times. |
| 59 | 58 | * @param int $count |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | * @class Table |
| 56 | 56 | * @package Platine\Console\Output |
| 57 | 57 | */ |
| 58 | -class Table |
|
| 59 | -{ |
|
| 58 | +class Table { |
|
| 60 | 59 | /** |
| 61 | 60 | * Render table data |
| 62 | 61 | * @param array<int, array<int, array<string, string>>> $rows |
@@ -609,8 +609,7 @@ discard block |
||
| 609 | 609 | * @method Writer darkgrayBgWhite(string $text, bool $eol = false) |
| 610 | 610 | * @method Writer darkgrayBgGray(string $text, bool $eol = false) |
| 611 | 611 | */ |
| 612 | -class Writer |
|
| 613 | -{ |
|
| 612 | +class Writer { |
|
| 614 | 613 | /** |
| 615 | 614 | * The output stream |
| 616 | 615 | * @var resource |
@@ -646,8 +645,7 @@ discard block |
||
| 646 | 645 | * @param string|null $path the output write path |
| 647 | 646 | * @param Color|null $color the color instance |
| 648 | 647 | */ |
| 649 | - public function __construct(?string $path = null, ?Color $color = null) |
|
| 650 | - { |
|
| 648 | + public function __construct(?string $path = null, ?Color $color = null) { |
|
| 651 | 649 | $stream = null; |
| 652 | 650 | if ($path !== null) { |
| 653 | 651 | $stream = fopen($path, 'w'); |
@@ -609,8 +609,7 @@ |
||
| 609 | 609 | * @method string darkgrayBgWhite(string $text) |
| 610 | 610 | * @method string darkgrayBgGray(string $text) |
| 611 | 611 | */ |
| 612 | -class Color |
|
| 613 | -{ |
|
| 612 | +class Color { |
|
| 614 | 613 | /** |
| 615 | 614 | * The color constants |
| 616 | 615 | */ |