@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function setup(): Cmd { |
14 | 14 | return Cmd::root() |
15 | - ->setCallable(static function (Cmd $cmd) { |
|
15 | + ->setCallable(static function(Cmd $cmd) { |
|
16 | 16 | echo 'Hello World' . self::EOL; |
17 | 17 | }); |
18 | 18 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | public function getOptionCollection(): OptionCollection { |
152 | 152 | |
153 | - if($this->optionCollection !== null) { |
|
153 | + if ($this->optionCollection !== null) { |
|
154 | 154 | return $this->optionCollection; |
155 | 155 | } |
156 | 156 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | public function handleOptionParseException(): void { |
176 | 176 | |
177 | - if($this->optionParseException === null) { |
|
177 | + if ($this->optionParseException === null) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | foreach ($oc->options as $option) { |
237 | 237 | |
238 | 238 | $s = ' '; |
239 | - if(!empty($option->short)) { |
|
239 | + if (!empty($option->short)) { |
|
240 | 240 | $s = '-' . $option->short . ', '; |
241 | 241 | } |
242 | 242 | $s .= '--' . $option->long; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | App::eol(); |
260 | 260 | } |
261 | 261 | |
262 | - if($has_subcommands) { |
|
262 | + if ($has_subcommands) { |
|
263 | 263 | |
264 | 264 | App::eol(); |
265 | 265 | App::echo('Available commands: ', Color::FOREGROUND_COLOR_YELLOW); |
@@ -17,13 +17,13 @@ |
||
17 | 17 | echo self::EOL; |
18 | 18 | } |
19 | 19 | |
20 | - public static function echo(string $str, ?string $foreground_color = null): void { |
|
20 | + public static function echo(string $str, ?string $foreground_color = null) : void { |
|
21 | 21 | |
22 | 22 | $lines = preg_split("/\r\n|\n|\r/", $str); |
23 | 23 | |
24 | 24 | $output = []; |
25 | - foreach($lines as $line) { |
|
26 | - if($foreground_color !== null) { |
|
25 | + foreach ($lines as $line) { |
|
26 | + if ($foreground_color !== null) { |
|
27 | 27 | $line = Color::getColoredString($line, $foreground_color); |
28 | 28 | } |
29 | 29 | $output[] = $line; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | 'isa' => 'string', |
22 | 22 | 'default' => 'World' |
23 | 23 | ]) |
24 | - ->setCallable(static function (Cmd $cmd) { |
|
24 | + ->setCallable(static function(Cmd $cmd) { |
|
25 | 25 | |
26 | 26 | $name = $cmd->optionResult->get('name'); |
27 | 27 | |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | self::echo(sprintf('Hello %s', $name), Color::FOREGROUND_COLOR_YELLOW); |
30 | 30 | self::eol(); |
31 | 31 | |
32 | - if($cmd->optionResult->has('verbose')) { |
|
32 | + if ($cmd->optionResult->has('verbose')) { |
|
33 | 33 | $keys = array_keys($cmd->optionResult->keys); |
34 | 34 | self::eol(); |
35 | 35 | self::echo('--- VERBOSE OUTPUT ---' . APP::EOL, Color::FOREGROUND_COLOR_GREEN); |
36 | 36 | self::eol(); |
37 | 37 | self::echo(' All current options...' . APP::EOL, Color::FOREGROUND_COLOR_GREEN); |
38 | - foreach($keys as $k) { |
|
38 | + foreach ($keys as $k) { |
|
39 | 39 | self::echo(' ' . $k . ': ' . $cmd->optionResult->get($k) . APP::EOL, Color::FOREGROUND_COLOR_GREEN); |
40 | 40 | } |
41 | 41 | self::eol(); |
42 | 42 | |
43 | 43 | self::echo(' All current arguments...' . APP::EOL, Color::FOREGROUND_COLOR_GREEN); |
44 | 44 | $args = $cmd->arguments; |
45 | - foreach($args as $a) { |
|
45 | + foreach ($args as $a) { |
|
46 | 46 | self::echo(' ' . $a . APP::EOL, Color::FOREGROUND_COLOR_GREEN); |
47 | 47 | } |
48 | 48 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | public function setup(): Cmd { |
15 | 15 | return Cmd::root() |
16 | - ->setCallable(static function (Cmd $cmd) { |
|
16 | + ->setCallable(static function(Cmd $cmd) { |
|
17 | 17 | $cmd->help(); |
18 | 18 | }) |
19 | 19 | ->addSubCmd( |