Passed
Push — master ( 42d472...9d6aee )
by Timm
02:01
created
examples/cli-app-helloworld.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Stefaminator/Cli/App.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
examples/cli-app-subcommands.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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(
Please login to merge, or discard this patch.
src/Stefaminator/Cli/Cmd.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     }
124 124
 
125 125
     public function getProvidedOption(string $key) {
126
-        if($this->optionResult !== null) {
126
+        if ($this->optionResult !== null) {
127 127
             return $this->optionResult->get($key);
128 128
         }
129 129
         return null;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
     public function getOptionCollection(): OptionCollection {
163 163
 
164
-        if($this->optionCollection !== null) {
164
+        if ($this->optionCollection !== null) {
165 165
             return $this->optionCollection;
166 166
         }
167 167
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
     public function handleOptionParseException(): bool {
187 187
 
188
-        if($this->optionParseException === null) {
188
+        if ($this->optionParseException === null) {
189 189
             return false;
190 190
         }
191 191
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             foreach ($oc->options as $option) {
248 248
 
249 249
                 $s = '    ';
250
-                if(!empty($option->short)) {
250
+                if (!empty($option->short)) {
251 251
                     $s = '-' . $option->short . ', ';
252 252
                 }
253 253
                 $s .= '--' . $option->long;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
             App::eol();
271 271
         }
272 272
 
273
-        if($has_subcommands) {
273
+        if ($has_subcommands) {
274 274
 
275 275
             App::eol();
276 276
             App::echo('Available commands: ', Color::FOREGROUND_COLOR_YELLOW);
Please login to merge, or discard this patch.
src/Stefaminator/Cli/AppParser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
             if ($cmd !== null) {
20 20
 
21
-                if($cmd->handleOptionParseException()) {
21
+                if ($cmd->handleOptionParseException()) {
22 22
                     return;
23 23
                 }
24 24
 
Please login to merge, or discard this patch.
examples/cli-app-options.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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->getProvidedOption('name');
27 27
 
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
                     self::echo(sprintf('Hello %s', $name), Color::FOREGROUND_COLOR_YELLOW);
30 30
                     self::eol();
31 31
 
32
-                    if($cmd->hasProvidedOption('verbose')) {
32
+                    if ($cmd->hasProvidedOption('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
 
Please login to merge, or discard this patch.