Passed
Push — develop ( f0e9ac...94fea8 )
by nguereza
02:02
created
src/Output/Cursor.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Output/Color.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -609,8 +609,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
src/Output/Table.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Application.php 1 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 1 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/Util/Helper.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@  discard block
 block discarded – undo
55 55
  * Class Helper
56 56
  * @package Platine\Console\Util
57 57
  */
58
-class Helper
59
-{
58
+class Helper {
60 59
     /**
61 60
      * Convert the given string to camel case
62 61
      * @param string $str
@@ -122,8 +121,7 @@  discard block
 block discarded – undo
122 121
      * @param string|null $value
123 122
      * @return mixed
124 123
      */
125
-    public static function normalizeValue(Parameter $parameter, ?string $value = null)
126
-    {
124
+    public static function normalizeValue(Parameter $parameter, ?string $value = null) {
127 125
         if ($parameter instanceof Option && $parameter->isBool()) {
128 126
             return !$parameter->getDefault();
129 127
         }
Please login to merge, or discard this patch.
src/Util/OutputHelper.php 1 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/Output/Writer.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -607,8 +607,7 @@  discard block
 block discarded – undo
607 607
  * @method Writer darkgrayBgWhite(string $text, bool $eol = false)
608 608
  * @method Writer darkgrayBgGray(string $text, bool $eol = false)
609 609
  */
610
-class Writer
611
-{
610
+class Writer {
612 611
     /**
613 612
      * The output stream
614 613
      * @var resource
@@ -644,8 +643,7 @@  discard block
 block discarded – undo
644 643
      * @param string|null $path the output write path
645 644
      * @param Color|null $color the color instance
646 645
      */
647
-    public function __construct(?string $path = null, ?Color $color = null)
648
-    {
646
+    public function __construct(?string $path = null, ?Color $color = null) {
649 647
         $stream = null;
650 648
         if ($path !== null) {
651 649
             $stream = fopen($path, 'w');
@@ -663,8 +661,7 @@  discard block
 block discarded – undo
663 661
      * @param resource $stream
664 662
      * @return $this
665 663
      */
666
-    public function setStream($stream)
667
-    {
664
+    public function setStream($stream) {
668 665
         $this->stream = $stream;
669 666
         return $this;
670 667
     }
@@ -674,8 +671,7 @@  discard block
 block discarded – undo
674 671
      * @param resource $stream
675 672
      * @return $this
676 673
      */
677
-    public function setErrorStream($stream)
678
-    {
674
+    public function setErrorStream($stream) {
679 675
         $this->errorStream = $stream;
680 676
         return $this;
681 677
     }
@@ -794,8 +790,7 @@  discard block
 block discarded – undo
794 790
      * @param array<int, mixed> $args
795 791
      * @return $this
796 792
      */
797
-    public function __call(string $method, array $args = [])
798
-    {
793
+    public function __call(string $method, array $args = []) {
799 794
         if (method_exists($this->cursor, $method)) {
800 795
             return $this->cursor->{$method}(...$args);
801 796
         }
Please login to merge, or discard this patch.
src/Input/Reader.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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');
@@ -79,8 +77,7 @@  discard block
 block discarded – undo
79 77
      * @param resource $stream
80 78
      * @return $this
81 79
      */
82
-    public function setStream($stream)
83
-    {
80
+    public function setStream($stream) {
84 81
         $this->stream = $stream;
85 82
         return $this;
86 83
     }
@@ -92,8 +89,7 @@  discard block
 block discarded – undo
92 89
      * @param callable|null $callback The validator/sanitizer callback.
93 90
      * @return mixed
94 91
      */
95
-    public function read($default = null, ?callable $callback = null)
96
-    {
92
+    public function read($default = null, ?callable $callback = null) {
97 93
         // see https://www.php.net/manual/en/filesystem.configuration.php#ini.auto-detect-line-endings
98 94
         ini_set('auto_detect_line_endings', 'true');
99 95
         $input = '';
@@ -117,8 +113,7 @@  discard block
 block discarded – undo
117 113
      * @param callable|null $callback The validator/sanitizer callback.
118 114
      * @return mixed
119 115
      */
120
-    public function readAll(?callable $callback = null)
121
-    {
116
+    public function readAll(?callable $callback = null) {
122 117
         $input = stream_get_contents($this->stream);
123 118
 
124 119
         return $callback !== null
@@ -131,8 +126,7 @@  discard block
 block discarded – undo
131 126
      * @param callable|null $callback The validator/sanitizer callback.
132 127
      * @return mixed
133 128
      */
134
-    public function readPipe(?callable $callback = null)
135
-    {
129
+    public function readPipe(?callable $callback = null) {
136 130
         $stdin = '';
137 131
         $read = [$this->stream];
138 132
         $write = [];
@@ -158,8 +152,7 @@  discard block
 block discarded – undo
158 152
      * @param callable|null $callback The validator/sanitizer callback.
159 153
      * @return mixed
160 154
      */
161
-    public function readHidden($default = null, ?callable $callback = null)
162
-    {
155
+    public function readHidden($default = null, ?callable $callback = null) {
163 156
         if (substr(strtoupper(PHP_OS), 0, 3) === 'WIN') {
164 157
             return $this->readHiddenWindows($default, $callback);
165 158
         }
@@ -180,8 +173,7 @@  discard block
 block discarded – undo
180 173
      * @param callable|null $callback The validator/sanitizer callback.
181 174
      * @return mixed
182 175
      */
183
-    protected function readHiddenWindows($default = null, ?callable $callback = null)
184
-    {
176
+    protected function readHiddenWindows($default = null, ?callable $callback = null) {
185 177
         $cmd = 'powershell -Command ' . implode('; ', array_filter([
186 178
                     '$pword = Read-Host -AsSecureString',
187 179
                     '$pword = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword)',
Please login to merge, or discard this patch.