@@ -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 | /** |
59 | 58 | * The input stream |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | * Create new instance |
66 | 65 | * @param string|null $path the input read path |
67 | 66 | */ |
68 | - public function __construct(?string $path = null) |
|
69 | - { |
|
67 | + public function __construct(?string $path = null) { |
|
70 | 68 | $stream = STDIN; |
71 | 69 | if ($path !== null) { |
72 | 70 | $stream = fopen($path, 'r'); |
@@ -81,8 +79,7 @@ discard block |
||
81 | 79 | * @param callable|null $callback The validator/sanitizer callback. |
82 | 80 | * @return mixed |
83 | 81 | */ |
84 | - public function read($default = null, ?callable $callback = null) |
|
85 | - { |
|
82 | + public function read($default = null, ?callable $callback = null) { |
|
86 | 83 | $in = ''; |
87 | 84 | $read = fgets($this->stream); |
88 | 85 | |
@@ -104,8 +101,7 @@ discard block |
||
104 | 101 | * @param callable|null $callback The validator/sanitizer callback. |
105 | 102 | * @return mixed |
106 | 103 | */ |
107 | - public function readAll(?callable $callback = null) |
|
108 | - { |
|
104 | + public function readAll(?callable $callback = null) { |
|
109 | 105 | $in = stream_get_contents($this->stream); |
110 | 106 | |
111 | 107 | return $callback !== null |
@@ -118,8 +114,7 @@ discard block |
||
118 | 114 | * @param callable|null $callback The validator/sanitizer callback. |
119 | 115 | * @return mixed |
120 | 116 | */ |
121 | - public function readPipe(?callable $callback = null) |
|
122 | - { |
|
117 | + public function readPipe(?callable $callback = null) { |
|
123 | 118 | $stdin = ''; |
124 | 119 | $read = [$this->stream]; |
125 | 120 | $write = []; |
@@ -145,8 +140,7 @@ discard block |
||
145 | 140 | * @param callable|null $callback The validator/sanitizer callback. |
146 | 141 | * @return mixed |
147 | 142 | */ |
148 | - public function readHidden($default = null, ?callable $callback = null) |
|
149 | - { |
|
143 | + public function readHidden($default = null, ?callable $callback = null) { |
|
150 | 144 | if (substr(strtoupper(PHP_OS), 0, 3) === 'WIN') { |
151 | 145 | return $this->readHiddenWindows($default, $callback); |
152 | 146 | } |
@@ -167,8 +161,7 @@ discard block |
||
167 | 161 | * @param callable|null $callback The validator/sanitizer callback. |
168 | 162 | * @return mixed |
169 | 163 | */ |
170 | - protected function readHiddenWindows($default = null, ?callable $callback = null) |
|
171 | - { |
|
164 | + protected function readHiddenWindows($default = null, ?callable $callback = null) { |
|
172 | 165 | $cmd = 'powershell -Command ' . implode('; ', array_filter([ |
173 | 166 | '$pword = Read-Host -AsSecureString', |
174 | 167 | '$pword = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword)', |
@@ -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 | /** |
59 | 58 | * The short option name |
@@ -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 | /** |
61 | 60 | * The name of the parameter |
@@ -183,8 +182,7 @@ discard block |
||
183 | 182 | * Return the parameter default value |
184 | 183 | * @return mixed |
185 | 184 | */ |
186 | - public function getDefault() |
|
187 | - { |
|
185 | + public function getDefault() { |
|
188 | 186 | if ($this->isVariadic()) { |
189 | 187 | return (array) $this->default; |
190 | 188 | } |
@@ -234,8 +232,7 @@ discard block |
||
234 | 232 | * @param mixed $raw |
235 | 233 | * @return mixed |
236 | 234 | */ |
237 | - public function filter($raw) |
|
238 | - { |
|
235 | + public function filter($raw) { |
|
239 | 236 | if ($this->filter !== null) { |
240 | 237 | $callback = $this->filter; |
241 | 238 |
@@ -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 | /** |
59 | 58 | * {@inheritdoc} |
@@ -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 | } |
@@ -58,8 +58,7 @@ discard block |
||
58 | 58 | * Class Interactor |
59 | 59 | * @package Platine\Console\IO |
60 | 60 | */ |
61 | -class Interactor |
|
62 | -{ |
|
61 | +class Interactor { |
|
63 | 62 | |
64 | 63 | /** |
65 | 64 | * Stream reader instance |
@@ -78,8 +77,7 @@ discard block |
||
78 | 77 | * @param string|null $input |
79 | 78 | * @param string|null $output |
80 | 79 | */ |
81 | - public function __construct(?string $input = null, ?string $output = null) |
|
82 | - { |
|
80 | + public function __construct(?string $input = null, ?string $output = null) { |
|
83 | 81 | $this->reader = new Reader($input); |
84 | 82 | $this->writer = new Writer($output); |
85 | 83 | } |
@@ -124,8 +122,7 @@ discard block |
||
124 | 122 | * |
125 | 123 | * @return mixed |
126 | 124 | */ |
127 | - public function choice(string $text, array $choices, $default = null, bool $case = false) |
|
128 | - { |
|
125 | + public function choice(string $text, array $choices, $default = null, bool $case = false) { |
|
129 | 126 | $this->writer->yellow($text); |
130 | 127 | |
131 | 128 | $this->listOptions($choices, $default, false); |
@@ -146,8 +143,7 @@ discard block |
||
146 | 143 | * |
147 | 144 | * @return mixed |
148 | 145 | */ |
149 | - public function choices(string $text, array $choices, $default = null, bool $case = false) |
|
150 | - { |
|
146 | + public function choices(string $text, array $choices, $default = null, bool $case = false) { |
|
151 | 147 | $this->writer->yellow($text); |
152 | 148 | |
153 | 149 | $this->listOptions($choices, $default, true); |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | * Class Writer |
53 | 53 | * @package Platine\Console\Output |
54 | 54 | */ |
55 | -class Writer |
|
56 | -{ |
|
55 | +class Writer { |
|
57 | 56 | |
58 | 57 | /** |
59 | 58 | * The output stream |
@@ -90,8 +89,7 @@ discard block |
||
90 | 89 | * @param string|null $path the output write path |
91 | 90 | * @param Color|null $color the color instance |
92 | 91 | */ |
93 | - public function __construct(?string $path = null, ?Color $color = null) |
|
94 | - { |
|
92 | + public function __construct(?string $path = null, ?Color $color = null) { |
|
95 | 93 | $stream = null; |
96 | 94 | if ($path !== null) { |
97 | 95 | $stream = fopen($path, 'w'); |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * Class Color |
53 | 53 | * @package Platine\Console\Output |
54 | 54 | */ |
55 | -class Color |
|
56 | -{ |
|
55 | +class Color { |
|
57 | 56 | |
58 | 57 | /** |
59 | 58 | * The color constants |
@@ -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 | /** |
59 | 58 | * Returns signal to move cursor up "count" times. |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | list($start, $end) = $normalizedStyles['head']; |
81 | 81 | foreach ($head as $col => $size) { |
82 | 82 | $dash[] = str_repeat('-', (int) $size + 2); |
83 | - $title[] = str_pad(Helper::toWords($col), (int)$size, ' '); |
|
83 | + $title[] = str_pad(Helper::toWords($col), (int) $size, ' '); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $titleStr = '|' . $start . ' ' |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $parts = []; |
93 | 93 | list($start, $end) = $normalizedStyles[['even', 'odd'][(int) $odd]]; |
94 | 94 | foreach ($head as $col => $size) { |
95 | - $parts[] = str_pad(isset($row[$col]) ? $row[$col] : '', (int)$size, ' '); |
|
95 | + $parts[] = str_pad(isset($row[$col]) ? $row[$col] : '', (int) $size, ' '); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | $odd = !$odd; |
@@ -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 | /** |
62 | 61 | * Render table data |