@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * Class Argument |
| 53 | 53 | * @package Platine\Console\Input |
| 54 | 54 | */ |
| 55 | -class Argument extends Parameter |
|
| 56 | -{ |
|
| 55 | +class Argument extends Parameter { |
|
| 57 | 56 | /** |
| 58 | 57 | * {@inheritdoc} |
| 59 | 58 | */ |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * Class Parameter |
| 55 | 55 | * @package Platine\Console\Input |
| 56 | 56 | */ |
| 57 | -abstract class Parameter |
|
| 58 | -{ |
|
| 57 | +abstract class Parameter { |
|
| 59 | 58 | /** |
| 60 | 59 | * The name of the parameter |
| 61 | 60 | * @var string |
@@ -182,8 +181,7 @@ discard block |
||
| 182 | 181 | * Return the parameter default value |
| 183 | 182 | * @return mixed |
| 184 | 183 | */ |
| 185 | - public function getDefault() |
|
| 186 | - { |
|
| 184 | + public function getDefault() { |
|
| 187 | 185 | if ($this->isVariadic()) { |
| 188 | 186 | return (array) $this->default; |
| 189 | 187 | } |
@@ -233,8 +231,7 @@ discard block |
||
| 233 | 231 | * @param mixed $raw |
| 234 | 232 | * @return mixed |
| 235 | 233 | */ |
| 236 | - public function filter($raw) |
|
| 237 | - { |
|
| 234 | + public function filter($raw) { |
|
| 238 | 235 | if ($this->filter !== null) { |
| 239 | 236 | $callback = $this->filter; |
| 240 | 237 | |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | * Class Parser |
| 57 | 57 | * @package Platine\Console\Input |
| 58 | 58 | */ |
| 59 | -abstract class Parser |
|
| 60 | -{ |
|
| 59 | +abstract class Parser { |
|
| 61 | 60 | /** |
| 62 | 61 | * The last seen variadic option name |
| 63 | 62 | * @var string|null |
@@ -189,8 +188,7 @@ discard block |
||
| 189 | 188 | * @param string $arg |
| 190 | 189 | * @return mixed |
| 191 | 190 | */ |
| 192 | - protected function parseArgument(string $arg) |
|
| 193 | - { |
|
| 191 | + protected function parseArgument(string $arg) { |
|
| 194 | 192 | if ($this->lastVariadic) { |
| 195 | 193 | return $this->set($this->lastVariadic, $arg, true); |
| 196 | 194 | } |
@@ -215,8 +213,7 @@ discard block |
||
| 215 | 213 | * @param string|null $nextArg |
| 216 | 214 | * @return mixed|bool |
| 217 | 215 | */ |
| 218 | - protected function parseOptions(string $arg, ?string $nextArg = null) |
|
| 219 | - { |
|
| 216 | + protected function parseOptions(string $arg, ?string $nextArg = null) { |
|
| 220 | 217 | $value = null; |
| 221 | 218 | if ($nextArg !== null && substr($nextArg, 0, 1) !== '-') { |
| 222 | 219 | $value = $nextArg; |
@@ -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 |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | * Class Reader |
| 53 | 53 | * @package Platine\Console\Input |
| 54 | 54 | */ |
| 55 | -class Reader |
|
| 56 | -{ |
|
| 55 | +class Reader { |
|
| 57 | 56 | /** |
| 58 | 57 | * The input stream |
| 59 | 58 | * @var resource |
@@ -64,8 +63,7 @@ discard block |
||
| 64 | 63 | * Create new instance |
| 65 | 64 | * @param string|null $path the input read path |
| 66 | 65 | */ |
| 67 | - public function __construct(?string $path = null) |
|
| 68 | - { |
|
| 66 | + public function __construct(?string $path = null) { |
|
| 69 | 67 | $stream = STDIN; |
| 70 | 68 | if ($path !== null) { |
| 71 | 69 | $stream = fopen($path, 'r'); |
@@ -80,8 +78,7 @@ discard block |
||
| 80 | 78 | * @param callable|null $callback The validator/sanitizer callback. |
| 81 | 79 | * @return mixed |
| 82 | 80 | */ |
| 83 | - public function read($default = null, ?callable $callback = null) |
|
| 84 | - { |
|
| 81 | + public function read($default = null, ?callable $callback = null) { |
|
| 85 | 82 | // see https://www.php.net/manual/en/filesystem.configuration.php#ini.auto-detect-line-endings |
| 86 | 83 | ini_set('auto_detect_line_endings', true); |
| 87 | 84 | $input = ''; |
@@ -105,8 +102,7 @@ discard block |
||
| 105 | 102 | * @param callable|null $callback The validator/sanitizer callback. |
| 106 | 103 | * @return mixed |
| 107 | 104 | */ |
| 108 | - public function readAll(?callable $callback = null) |
|
| 109 | - { |
|
| 105 | + public function readAll(?callable $callback = null) { |
|
| 110 | 106 | $input = stream_get_contents($this->stream); |
| 111 | 107 | |
| 112 | 108 | return $callback !== null |
@@ -119,8 +115,7 @@ discard block |
||
| 119 | 115 | * @param callable|null $callback The validator/sanitizer callback. |
| 120 | 116 | * @return mixed |
| 121 | 117 | */ |
| 122 | - public function readPipe(?callable $callback = null) |
|
| 123 | - { |
|
| 118 | + public function readPipe(?callable $callback = null) { |
|
| 124 | 119 | $stdin = ''; |
| 125 | 120 | $read = [$this->stream]; |
| 126 | 121 | $write = []; |
@@ -146,8 +141,7 @@ discard block |
||
| 146 | 141 | * @param callable|null $callback The validator/sanitizer callback. |
| 147 | 142 | * @return mixed |
| 148 | 143 | */ |
| 149 | - public function readHidden($default = null, ?callable $callback = null) |
|
| 150 | - { |
|
| 144 | + public function readHidden($default = null, ?callable $callback = null) { |
|
| 151 | 145 | if (substr(strtoupper(PHP_OS), 0, 3) === 'WIN') { |
| 152 | 146 | return $this->readHiddenWindows($default, $callback); |
| 153 | 147 | } |
@@ -168,8 +162,7 @@ discard block |
||
| 168 | 162 | * @param callable|null $callback The validator/sanitizer callback. |
| 169 | 163 | * @return mixed |
| 170 | 164 | */ |
| 171 | - protected function readHiddenWindows($default = null, ?callable $callback = null) |
|
| 172 | - { |
|
| 165 | + protected function readHiddenWindows($default = null, ?callable $callback = null) { |
|
| 173 | 166 | $cmd = 'powershell -Command ' . implode('; ', array_filter([ |
| 174 | 167 | '$pword = Read-Host -AsSecureString', |
| 175 | 168 | '$pword = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword)', |
@@ -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 | } |
@@ -122,8 +120,7 @@ discard block |
||
| 122 | 120 | * |
| 123 | 121 | * @return mixed |
| 124 | 122 | */ |
| 125 | - public function choice(string $text, array $choices, $default = null, bool $case = false) |
|
| 126 | - { |
|
| 123 | + public function choice(string $text, array $choices, $default = null, bool $case = false) { |
|
| 127 | 124 | $this->writer->yellow($text); |
| 128 | 125 | |
| 129 | 126 | $this->listOptions($choices, $default, false); |
@@ -144,8 +141,7 @@ discard block |
||
| 144 | 141 | * |
| 145 | 142 | * @return mixed |
| 146 | 143 | */ |
| 147 | - public function choices(string $text, array $choices, $default = null, bool $case = false) |
|
| 148 | - { |
|
| 144 | + public function choices(string $text, array $choices, $default = null, bool $case = false) { |
|
| 149 | 145 | $this->writer->yellow($text); |
| 150 | 146 | |
| 151 | 147 | $this->listOptions($choices, $default, true); |
@@ -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 |
@@ -609,8 +609,7 @@ discard block |
||
| 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 | */ |
@@ -765,8 +764,7 @@ discard block |
||
| 765 | 764 | * @return mixed |
| 766 | 765 | * @throws Error |
| 767 | 766 | */ |
| 768 | - public function __call(string $method, array $args = []) |
|
| 769 | - { |
|
| 767 | + public function __call(string $method, array $args = []) { |
|
| 770 | 768 | $colors = [ |
| 771 | 769 | 'black' => self::BLACK, |
| 772 | 770 | 'red' => self::RED, |
@@ -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 |