Passed
Push — develop ( f0e9ac...94fea8 )
by nguereza
02:02
created
src/Exception/RuntimeException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,6 +38,5 @@
 block discarded – undo
38 38
  * Class RuntimeException
39 39
  * @package Platine\Console\Exception
40 40
  */
41
-class RuntimeException extends ConsoleException
42
-{
41
+class RuntimeException extends ConsoleException {
43 42
 }
Please login to merge, or discard this patch.
src/Exception/ConsoleException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,6 +40,5 @@
 block discarded – undo
40 40
  * Class ConsoleException
41 41
  * @package Platine\Console\Exception
42 42
  */
43
-class ConsoleException extends Exception
44
-{
43
+class ConsoleException extends Exception {
45 44
 }
Please login to merge, or discard this patch.
src/Exception/InvalidParameterException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,6 +38,5 @@
 block discarded – undo
38 38
  * Class InvalidParameterException
39 39
  * @package Platine\Console\Exception
40 40
  */
41
-class InvalidParameterException extends ConsoleException
42
-{
41
+class InvalidParameterException extends ConsoleException {
43 42
 }
Please login to merge, or discard this patch.
src/Exception/InvalidArgumentException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,6 +38,5 @@
 block discarded – undo
38 38
  * Class InvalidArgumentException
39 39
  * @package Platine\Console\Exception
40 40
  */
41
-class InvalidArgumentException extends ConsoleException
42
-{
41
+class InvalidArgumentException extends ConsoleException {
43 42
 }
Please login to merge, or discard this patch.
src/Util/OutputHelper.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         string $header = '',
180 180
         string $footer = ''
181 181
     ): self {
182
-        $this->maxCommandWidth = !empty($items) ? max(array_map(function (Command $item) {
182
+        $this->maxCommandWidth = !empty($items) ? max(array_map(function(Command $item) {
183 183
             return strlen($item->getName());
184 184
         }, $items)) : 0;
185 185
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         $maxLength = (int) max($lines) + 4;
232 232
         $formatedUsage = (string) preg_replace_callback(
233 233
             '~ ## ~',
234
-            function () use (&$lines, $maxLength) {
234
+            function() use (&$lines, $maxLength) {
235 235
                 $sizeOfLine = 0;
236 236
                 $currentLine = array_shift($lines);
237 237
                 if ($currentLine !== null) {
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
      */
388 388
     protected function sortItems(array $items, int &$max = 0): array
389 389
     {
390
-        $max = max(array_map(function ($item) {
390
+        $max = max(array_map(function($item) {
391 391
             return strlen($this->getName($item));
392 392
         }, $items));
393 393
 
394
-        uasort($items, function ($a, $b) {
394
+        uasort($items, function($a, $b) {
395 395
             /* @var Parameter $b */
396 396
             /* @var Parameter $a */
397 397
             return $a->getName() <=> $b->getName();
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,8 +60,7 @@  discard block
 block discarded – undo
60 60
  * Class OutputHelper
61 61
  * @package Platine\Console\Util
62 62
  */
63
-class OutputHelper
64
-{
63
+class OutputHelper {
65 64
     /**
66 65
      * The writer stream instance
67 66
      * @var Writer
@@ -78,8 +77,7 @@  discard block
 block discarded – undo
78 77
      * Create new instance
79 78
      * @param Writer|null $writer
80 79
      */
81
-    public function __construct(?Writer $writer = null)
82
-    {
80
+    public function __construct(?Writer $writer = null) {
83 81
         $this->writer = $writer ? $writer : new Writer();
84 82
     }
85 83
 
Please login to merge, or discard this patch.
src/Input/Parser.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     {
221 221
         $value = null;
222 222
         if ($nextArg !== null && substr($nextArg, 0, 1) !== '-') {
223
-            $value =  $nextArg;
223
+            $value = $nextArg;
224 224
         }
225 225
 
226 226
         $option = $this->getOptionForArgument($arg);
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         /** @var array<Parameter> $missingItems */
297 297
         $missingItems = array_filter(
298 298
             $this->options + $this->arguments,
299
-            function ($item) {
299
+            function($item) {
300 300
             /** @var Parameter $item */
301 301
                 return $item->isRequired() && in_array(
302 302
                     $this->values[$item->getAttributeName()],
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Application.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@
 block discarded – undo
124 124
         $this->name = $name;
125 125
         $this->version = $version;
126 126
 
127
-        $this->onExit = $onExit ? $onExit : function (int $exitCode = 0) {
127
+        $this->onExit = $onExit ? $onExit : function(int $exitCode = 0) {
128 128
             //@codeCoverageIgnoreStart
129 129
             exit($exitCode);
130 130
             //@codeCoverageIgnoreEnd
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@  discard block
 block discarded – undo
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 array<Command>
@@ -339,8 +338,7 @@  discard block
 block discarded – undo
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
         }
@@ -367,8 +365,7 @@  discard block
 block discarded – undo
367 365
      * Show help of all commands.
368 366
      * @return mixed
369 367
      */
370
-    public function showHelp()
371
-    {
368
+    public function showHelp() {
372 369
         $writer = $this->io()->writer();
373 370
 
374 371
         $header = sprintf(
@@ -418,8 +415,7 @@  discard block
 block discarded – undo
418 415
      * @param Command $command
419 416
      * @return mixed
420 417
      */
421
-    protected function executeCommand(Command $command)
422
-    {
418
+    protected function executeCommand(Command $command) {
423 419
         if ($command->getName() === '__default__') {
424 420
             return $this->showCommandNotFound();
425 421
         }
@@ -446,8 +442,7 @@  discard block
 block discarded – undo
446 442
      * Command not found handler.
447 443
      * @return mixed
448 444
      */
449
-    protected function showCommandNotFound()
450
-    {
445
+    protected function showCommandNotFound() {
451 446
         $available = array_keys($this->getCommands() + $this->aliases);
452 447
 
453 448
         $this->outputHelper()
Please login to merge, or discard this patch.
src/Command/Command.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -584,13 +584,13 @@
 block discarded – undo
584 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
-        $this->onExit(function (int $exitCode = 0) {
593
+        $this->onExit(function(int $exitCode = 0) {
594 594
             $this->terminate($exitCode);
595 595
         });
596 596
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -64,8 +64,7 @@  discard block
 block discarded – undo
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
@@ -395,8 +394,7 @@  discard block
 block discarded – undo
395 394
      * Show this command help and abort
396 395
      * @return mixed
397 396
      */
398
-    public function showHelp()
399
-    {
397
+    public function showHelp() {
400 398
         $io = $this->io();
401 399
         $helper = new OutputHelper($io->writer());
402 400
 
@@ -442,8 +440,7 @@  discard block
 block discarded – undo
442 440
      * Show this command version and abort
443 441
      * @return mixed
444 442
      */
445
-    public function showVersion()
446
-    {
443
+    public function showVersion() {
447 444
         $this->writer()->bold(
448 445
             sprintf(
449 446
                 '%s, %s',
@@ -460,8 +457,7 @@  discard block
 block discarded – undo
460 457
      * Execute the command
461 458
      * @return mixed
462 459
      */
463
-    public function execute()
464
-    {
460
+    public function execute() {
465 461
     }
466 462
 
467 463
     /**
@@ -480,16 +476,14 @@  discard block
 block discarded – undo
480 476
      * @param mixed $object
481 477
      * @return mixed
482 478
      */
483
-    public function tap($object = null)
484
-    {
479
+    public function tap($object = null) {
485 480
         return $object ?? $this->app;
486 481
     }
487 482
 
488 483
     /**
489 484
      * {@inheritdoc}
490 485
      */
491
-    public function emit(string $event, $value = null)
492
-    {
486
+    public function emit(string $event, $value = null) {
493 487
         if (empty($this->events[$event])) {
494 488
             return null;
495 489
         }
@@ -502,8 +496,7 @@  discard block
 block discarded – undo
502 496
      * @param string $longName
503 497
      * @return mixed|null
504 498
      */
505
-    public function getOptionValue(string $longName)
506
-    {
499
+    public function getOptionValue(string $longName) {
507 500
         $values = $this->values();
508 501
 
509 502
         return array_key_exists($longName, $values)
@@ -516,8 +509,7 @@  discard block
 block discarded – undo
516 509
      * @param string $name
517 510
      * @return mixed|null
518 511
      */
519
-    public function getArgumentValue(string $name)
520
-    {
512
+    public function getArgumentValue(string $name) {
521 513
         $values = $this->values();
522 514
 
523 515
         return array_key_exists($name, $values)
@@ -550,8 +542,7 @@  discard block
 block discarded – undo
550 542
     /**
551 543
      * {@inheritdoc}
552 544
      */
553
-    protected function handleUnknown(string $arg, $value = null)
554
-    {
545
+    protected function handleUnknown(string $arg, $value = null) {
555 546
         if ($this->allowUnknown) {
556 547
             return $this->set(Helper::toCamelCase($arg), $value);
557 548
         }
Please login to merge, or discard this patch.
src/Command/Shell.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'
Please login to merge, or discard this patch.