Completed
Push — develop ( d12426...aff1bc )
by Zack
18:32
created
vendor/symfony/console/Event/ConsoleCommandEvent.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -18,34 +18,34 @@
 block discarded – undo
18 18
  */
19 19
 final class ConsoleCommandEvent extends ConsoleEvent
20 20
 {
21
-    /**
22
-     * The return code for skipped commands, this will also be passed into the terminate event.
23
-     */
24
-    public const RETURN_CODE_DISABLED = 113;
21
+	/**
22
+	 * The return code for skipped commands, this will also be passed into the terminate event.
23
+	 */
24
+	public const RETURN_CODE_DISABLED = 113;
25 25
 
26
-    /**
27
-     * Indicates if the command should be run or skipped.
28
-     */
29
-    private $commandShouldRun = true;
26
+	/**
27
+	 * Indicates if the command should be run or skipped.
28
+	 */
29
+	private $commandShouldRun = true;
30 30
 
31
-    /**
32
-     * Disables the command, so it won't be run.
33
-     */
34
-    public function disableCommand(): bool
35
-    {
36
-        return $this->commandShouldRun = false;
37
-    }
31
+	/**
32
+	 * Disables the command, so it won't be run.
33
+	 */
34
+	public function disableCommand(): bool
35
+	{
36
+		return $this->commandShouldRun = false;
37
+	}
38 38
 
39
-    public function enableCommand(): bool
40
-    {
41
-        return $this->commandShouldRun = true;
42
-    }
39
+	public function enableCommand(): bool
40
+	{
41
+		return $this->commandShouldRun = true;
42
+	}
43 43
 
44
-    /**
45
-     * Returns true if the command is runnable, false otherwise.
46
-     */
47
-    public function commandShouldRun(): bool
48
-    {
49
-        return $this->commandShouldRun;
50
-    }
44
+	/**
45
+	 * Returns true if the command is runnable, false otherwise.
46
+	 */
47
+	public function commandShouldRun(): bool
48
+	{
49
+		return $this->commandShouldRun;
50
+	}
51 51
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@
 block discarded – undo
16 16
  *
17 17
  * @author Fabien Potencier <[email protected]>
18 18
  */
19
-final class ConsoleCommandEvent extends ConsoleEvent
20
-{
19
+final class ConsoleCommandEvent extends ConsoleEvent {
21 20
     /**
22 21
      * The return code for skipped commands, this will also be passed into the terminate event.
23 22
      */
Please login to merge, or discard this patch.
vendor/symfony/console/Event/ConsoleErrorEvent.php 3 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -22,37 +22,37 @@
 block discarded – undo
22 22
  */
23 23
 final class ConsoleErrorEvent extends ConsoleEvent
24 24
 {
25
-    private $error;
26
-    private $exitCode;
27
-
28
-    public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null)
29
-    {
30
-        parent::__construct($command, $input, $output);
31
-
32
-        $this->error = $error;
33
-    }
34
-
35
-    public function getError(): \Throwable
36
-    {
37
-        return $this->error;
38
-    }
39
-
40
-    public function setError(\Throwable $error): void
41
-    {
42
-        $this->error = $error;
43
-    }
44
-
45
-    public function setExitCode(int $exitCode): void
46
-    {
47
-        $this->exitCode = $exitCode;
48
-
49
-        $r = new \ReflectionProperty($this->error, 'code');
50
-        $r->setAccessible(true);
51
-        $r->setValue($this->error, $this->exitCode);
52
-    }
53
-
54
-    public function getExitCode(): int
55
-    {
56
-        return $this->exitCode ?? (\is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1);
57
-    }
25
+	private $error;
26
+	private $exitCode;
27
+
28
+	public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null)
29
+	{
30
+		parent::__construct($command, $input, $output);
31
+
32
+		$this->error = $error;
33
+	}
34
+
35
+	public function getError(): \Throwable
36
+	{
37
+		return $this->error;
38
+	}
39
+
40
+	public function setError(\Throwable $error): void
41
+	{
42
+		$this->error = $error;
43
+	}
44
+
45
+	public function setExitCode(int $exitCode): void
46
+	{
47
+		$this->exitCode = $exitCode;
48
+
49
+		$r = new \ReflectionProperty($this->error, 'code');
50
+		$r->setAccessible(true);
51
+		$r->setValue($this->error, $this->exitCode);
52
+	}
53
+
54
+	public function getExitCode(): int
55
+	{
56
+		return $this->exitCode ?? (\is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1);
57
+	}
58 58
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
     private $error;
26 26
     private $exitCode;
27 27
 
28
-    public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null)
28
+    public function __construct( InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null )
29 29
     {
30
-        parent::__construct($command, $input, $output);
30
+        parent::__construct( $command, $input, $output );
31 31
 
32 32
         $this->error = $error;
33 33
     }
@@ -37,22 +37,22 @@  discard block
 block discarded – undo
37 37
         return $this->error;
38 38
     }
39 39
 
40
-    public function setError(\Throwable $error): void
40
+    public function setError( \Throwable $error ): void
41 41
     {
42 42
         $this->error = $error;
43 43
     }
44 44
 
45
-    public function setExitCode(int $exitCode): void
45
+    public function setExitCode( int $exitCode ): void
46 46
     {
47 47
         $this->exitCode = $exitCode;
48 48
 
49
-        $r = new \ReflectionProperty($this->error, 'code');
50
-        $r->setAccessible(true);
51
-        $r->setValue($this->error, $this->exitCode);
49
+        $r = new \ReflectionProperty( $this->error, 'code' );
50
+        $r->setAccessible( true );
51
+        $r->setValue( $this->error, $this->exitCode );
52 52
     }
53 53
 
54 54
     public function getExitCode(): int
55 55
     {
56
-        return $this->exitCode ?? (\is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1);
56
+        return $this->exitCode ?? ( \is_int( $this->error->getCode() ) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1 );
57 57
     }
58 58
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,13 +20,11 @@
 block discarded – undo
20 20
  *
21 21
  * @author Wouter de Jong <[email protected]>
22 22
  */
23
-final class ConsoleErrorEvent extends ConsoleEvent
24
-{
23
+final class ConsoleErrorEvent extends ConsoleEvent {
25 24
     private $error;
26 25
     private $exitCode;
27 26
 
28
-    public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null)
29
-    {
27
+    public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null) {
30 28
         parent::__construct($command, $input, $output);
31 29
 
32 30
         $this->error = $error;
Please login to merge, or discard this patch.
vendor/symfony/console/Event/ConsoleTerminateEvent.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,22 +22,22 @@
 block discarded – undo
22 22
  */
23 23
 final class ConsoleTerminateEvent extends ConsoleEvent
24 24
 {
25
-    private $exitCode;
25
+	private $exitCode;
26 26
 
27
-    public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
28
-    {
29
-        parent::__construct($command, $input, $output);
27
+	public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
28
+	{
29
+		parent::__construct($command, $input, $output);
30 30
 
31
-        $this->setExitCode($exitCode);
32
-    }
31
+		$this->setExitCode($exitCode);
32
+	}
33 33
 
34
-    public function setExitCode(int $exitCode): void
35
-    {
36
-        $this->exitCode = $exitCode;
37
-    }
34
+	public function setExitCode(int $exitCode): void
35
+	{
36
+		$this->exitCode = $exitCode;
37
+	}
38 38
 
39
-    public function getExitCode(): int
40
-    {
41
-        return $this->exitCode;
42
-    }
39
+	public function getExitCode(): int
40
+	{
41
+		return $this->exitCode;
42
+	}
43 43
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 {
25 25
     private $exitCode;
26 26
 
27
-    public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
27
+    public function __construct( Command $command, InputInterface $input, OutputInterface $output, int $exitCode )
28 28
     {
29
-        parent::__construct($command, $input, $output);
29
+        parent::__construct( $command, $input, $output );
30 30
 
31
-        $this->setExitCode($exitCode);
31
+        $this->setExitCode( $exitCode );
32 32
     }
33 33
 
34
-    public function setExitCode(int $exitCode): void
34
+    public function setExitCode( int $exitCode ): void
35 35
     {
36 36
         $this->exitCode = $exitCode;
37 37
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,12 +20,10 @@
 block discarded – undo
20 20
  *
21 21
  * @author Francesco Levorato <[email protected]>
22 22
  */
23
-final class ConsoleTerminateEvent extends ConsoleEvent
24
-{
23
+final class ConsoleTerminateEvent extends ConsoleEvent {
25 24
     private $exitCode;
26 25
 
27
-    public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
28
-    {
26
+    public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode) {
29 27
         parent::__construct($command, $input, $output);
30 28
 
31 29
         $this->setExitCode($exitCode);
Please login to merge, or discard this patch.
vendor/symfony/console/Event/ConsoleEvent.php 3 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -23,45 +23,45 @@
 block discarded – undo
23 23
  */
24 24
 class ConsoleEvent extends Event
25 25
 {
26
-    protected $command;
26
+	protected $command;
27 27
 
28
-    private $input;
29
-    private $output;
28
+	private $input;
29
+	private $output;
30 30
 
31
-    public function __construct(?Command $command, InputInterface $input, OutputInterface $output)
32
-    {
33
-        $this->command = $command;
34
-        $this->input = $input;
35
-        $this->output = $output;
36
-    }
31
+	public function __construct(?Command $command, InputInterface $input, OutputInterface $output)
32
+	{
33
+		$this->command = $command;
34
+		$this->input = $input;
35
+		$this->output = $output;
36
+	}
37 37
 
38
-    /**
39
-     * Gets the command that is executed.
40
-     *
41
-     * @return Command|null A Command instance
42
-     */
43
-    public function getCommand()
44
-    {
45
-        return $this->command;
46
-    }
38
+	/**
39
+	 * Gets the command that is executed.
40
+	 *
41
+	 * @return Command|null A Command instance
42
+	 */
43
+	public function getCommand()
44
+	{
45
+		return $this->command;
46
+	}
47 47
 
48
-    /**
49
-     * Gets the input instance.
50
-     *
51
-     * @return InputInterface An InputInterface instance
52
-     */
53
-    public function getInput()
54
-    {
55
-        return $this->input;
56
-    }
48
+	/**
49
+	 * Gets the input instance.
50
+	 *
51
+	 * @return InputInterface An InputInterface instance
52
+	 */
53
+	public function getInput()
54
+	{
55
+		return $this->input;
56
+	}
57 57
 
58
-    /**
59
-     * Gets the output instance.
60
-     *
61
-     * @return OutputInterface An OutputInterface instance
62
-     */
63
-    public function getOutput()
64
-    {
65
-        return $this->output;
66
-    }
58
+	/**
59
+	 * Gets the output instance.
60
+	 *
61
+	 * @return OutputInterface An OutputInterface instance
62
+	 */
63
+	public function getOutput()
64
+	{
65
+		return $this->output;
66
+	}
67 67
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     private $input;
29 29
     private $output;
30 30
 
31
-    public function __construct(?Command $command, InputInterface $input, OutputInterface $output)
31
+    public function __construct( ?Command $command, InputInterface $input, OutputInterface $output )
32 32
     {
33 33
         $this->command = $command;
34 34
         $this->input = $input;
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,15 +21,13 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @author Francesco Levorato <[email protected]>
23 23
  */
24
-class ConsoleEvent extends Event
25
-{
24
+class ConsoleEvent extends Event {
26 25
     protected $command;
27 26
 
28 27
     private $input;
29 28
     private $output;
30 29
 
31
-    public function __construct(?Command $command, InputInterface $input, OutputInterface $output)
32
-    {
30
+    public function __construct(?Command $command, InputInterface $input, OutputInterface $output) {
33 31
         $this->command = $command;
34 32
         $this->input = $input;
35 33
         $this->output = $output;
@@ -40,8 +38,7 @@  discard block
 block discarded – undo
40 38
      *
41 39
      * @return Command|null A Command instance
42 40
      */
43
-    public function getCommand()
44
-    {
41
+    public function getCommand() {
45 42
         return $this->command;
46 43
     }
47 44
 
@@ -50,8 +47,7 @@  discard block
 block discarded – undo
50 47
      *
51 48
      * @return InputInterface An InputInterface instance
52 49
      */
53
-    public function getInput()
54
-    {
50
+    public function getInput() {
55 51
         return $this->input;
56 52
     }
57 53
 
@@ -60,8 +56,7 @@  discard block
 block discarded – undo
60 56
      *
61 57
      * @return OutputInterface An OutputInterface instance
62 58
      */
63
-    public function getOutput()
64
-    {
59
+    public function getOutput() {
65 60
         return $this->output;
66 61
     }
67 62
 }
Please login to merge, or discard this patch.
vendor/symfony/console/Event/ConsoleSignalEvent.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@
 block discarded – undo
20 20
  */
21 21
 final class ConsoleSignalEvent extends ConsoleEvent
22 22
 {
23
-    private $handlingSignal;
23
+	private $handlingSignal;
24 24
 
25
-    public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal)
26
-    {
27
-        parent::__construct($command, $input, $output);
28
-        $this->handlingSignal = $handlingSignal;
29
-    }
25
+	public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal)
26
+	{
27
+		parent::__construct($command, $input, $output);
28
+		$this->handlingSignal = $handlingSignal;
29
+	}
30 30
 
31
-    public function getHandlingSignal(): int
32
-    {
33
-        return $this->handlingSignal;
34
-    }
31
+	public function getHandlingSignal(): int
32
+	{
33
+		return $this->handlingSignal;
34
+	}
35 35
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 {
23 23
     private $handlingSignal;
24 24
 
25
-    public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal)
25
+    public function __construct( Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal )
26 26
     {
27
-        parent::__construct($command, $input, $output);
27
+        parent::__construct( $command, $input, $output );
28 28
         $this->handlingSignal = $handlingSignal;
29 29
     }
30 30
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,12 +18,10 @@
 block discarded – undo
18 18
 /**
19 19
  * @author marie <[email protected]>
20 20
  */
21
-final class ConsoleSignalEvent extends ConsoleEvent
22
-{
21
+final class ConsoleSignalEvent extends ConsoleEvent {
23 22
     private $handlingSignal;
24 23
 
25
-    public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal)
26
-    {
24
+    public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal) {
27 25
         parent::__construct($command, $input, $output);
28 26
         $this->handlingSignal = $handlingSignal;
29 27
     }
Please login to merge, or discard this patch.
vendor/symfony/console/Attribute/AsCommand.php 3 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,23 +17,23 @@
 block discarded – undo
17 17
 #[\Attribute(\Attribute::TARGET_CLASS)]
18 18
 class AsCommand
19 19
 {
20
-    public function __construct(
21
-        public string $name,
22
-        public ?string $description = null,
23
-        array $aliases = [],
24
-        bool $hidden = false,
25
-    ) {
26
-        if (!$hidden && !$aliases) {
27
-            return;
28
-        }
20
+	public function __construct(
21
+		public string $name,
22
+		public ?string $description = null,
23
+		array $aliases = [],
24
+		bool $hidden = false,
25
+	) {
26
+		if (!$hidden && !$aliases) {
27
+			return;
28
+		}
29 29
 
30
-        $name = explode('|', $name);
31
-        $name = array_merge($name, $aliases);
30
+		$name = explode('|', $name);
31
+		$name = array_merge($name, $aliases);
32 32
 
33
-        if ($hidden && '' !== $name[0]) {
34
-            array_unshift($name, '');
35
-        }
33
+		if ($hidden && '' !== $name[0]) {
34
+			array_unshift($name, '');
35
+		}
36 36
 
37
-        $this->name = implode('|', $name);
38
-    }
37
+		$this->name = implode('|', $name);
38
+	}
39 39
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,20 +20,20 @@
 block discarded – undo
20 20
     public function __construct(
21 21
         public string $name,
22 22
         public ?string $description = null,
23
-        array $aliases = [],
23
+        array $aliases = [ ],
24 24
         bool $hidden = false,
25 25
     ) {
26
-        if (!$hidden && !$aliases) {
26
+        if ( ! $hidden && ! $aliases ) {
27 27
             return;
28 28
         }
29 29
 
30
-        $name = explode('|', $name);
31
-        $name = array_merge($name, $aliases);
30
+        $name = explode( '|', $name );
31
+        $name = array_merge( $name, $aliases );
32 32
 
33
-        if ($hidden && '' !== $name[0]) {
34
-            array_unshift($name, '');
33
+        if ( $hidden && '' !== $name[ 0 ] ) {
34
+            array_unshift( $name, '' );
35 35
         }
36 36
 
37
-        $this->name = implode('|', $name);
37
+        $this->name = implode( '|', $name );
38 38
     }
39 39
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@
 block discarded – undo
15 15
  * Service tag to autoconfigure commands.
16 16
  */
17 17
 #[\Attribute(\Attribute::TARGET_CLASS)]
18
-class AsCommand
19
-{
18
+class AsCommand {
20 19
     public function __construct(
21 20
         public string $name,
22 21
         public ?string $description = null,
Please login to merge, or discard this patch.
vendor/symfony/console/Descriptor/TextDescriptor.php 3 patches
Indentation   +310 added lines, -310 removed lines patch added patch discarded remove patch
@@ -28,314 +28,314 @@
 block discarded – undo
28 28
  */
29 29
 class TextDescriptor extends Descriptor
30 30
 {
31
-    /**
32
-     * {@inheritdoc}
33
-     */
34
-    protected function describeInputArgument(InputArgument $argument, array $options = [])
35
-    {
36
-        if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
37
-            $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
38
-        } else {
39
-            $default = '';
40
-        }
41
-
42
-        $totalWidth = $options['total_width'] ?? Helper::width($argument->getName());
43
-        $spacingWidth = $totalWidth - \strlen($argument->getName());
44
-
45
-        $this->writeText(sprintf('  <info>%s</info>  %s%s%s',
46
-            $argument->getName(),
47
-            str_repeat(' ', $spacingWidth),
48
-            // + 4 = 2 spaces before <info>, 2 spaces after </info>
49
-            preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
50
-            $default
51
-        ), $options);
52
-    }
53
-
54
-    /**
55
-     * {@inheritdoc}
56
-     */
57
-    protected function describeInputOption(InputOption $option, array $options = [])
58
-    {
59
-        if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
60
-            $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
61
-        } else {
62
-            $default = '';
63
-        }
64
-
65
-        $value = '';
66
-        if ($option->acceptValue()) {
67
-            $value = '='.strtoupper($option->getName());
68
-
69
-            if ($option->isValueOptional()) {
70
-                $value = '['.$value.']';
71
-            }
72
-        }
73
-
74
-        $totalWidth = $options['total_width'] ?? $this->calculateTotalWidthForOptions([$option]);
75
-        $synopsis = sprintf('%s%s',
76
-            $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : '    ',
77
-            sprintf($option->isNegatable() ? '--%1$s|--no-%1$s' : '--%1$s%2$s', $option->getName(), $value)
78
-        );
79
-
80
-        $spacingWidth = $totalWidth - Helper::width($synopsis);
81
-
82
-        $this->writeText(sprintf('  <info>%s</info>  %s%s%s%s',
83
-            $synopsis,
84
-            str_repeat(' ', $spacingWidth),
85
-            // + 4 = 2 spaces before <info>, 2 spaces after </info>
86
-            preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
87
-            $default,
88
-            $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
89
-        ), $options);
90
-    }
91
-
92
-    /**
93
-     * {@inheritdoc}
94
-     */
95
-    protected function describeInputDefinition(InputDefinition $definition, array $options = [])
96
-    {
97
-        $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
98
-        foreach ($definition->getArguments() as $argument) {
99
-            $totalWidth = max($totalWidth, Helper::width($argument->getName()));
100
-        }
101
-
102
-        if ($definition->getArguments()) {
103
-            $this->writeText('<comment>Arguments:</comment>', $options);
104
-            $this->writeText("\n");
105
-            foreach ($definition->getArguments() as $argument) {
106
-                $this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth]));
107
-                $this->writeText("\n");
108
-            }
109
-        }
110
-
111
-        if ($definition->getArguments() && $definition->getOptions()) {
112
-            $this->writeText("\n");
113
-        }
114
-
115
-        if ($definition->getOptions()) {
116
-            $laterOptions = [];
117
-
118
-            $this->writeText('<comment>Options:</comment>', $options);
119
-            foreach ($definition->getOptions() as $option) {
120
-                if (\strlen($option->getShortcut() ?? '') > 1) {
121
-                    $laterOptions[] = $option;
122
-                    continue;
123
-                }
124
-                $this->writeText("\n");
125
-                $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
126
-            }
127
-            foreach ($laterOptions as $option) {
128
-                $this->writeText("\n");
129
-                $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
130
-            }
131
-        }
132
-    }
133
-
134
-    /**
135
-     * {@inheritdoc}
136
-     */
137
-    protected function describeCommand(Command $command, array $options = [])
138
-    {
139
-        $command->mergeApplicationDefinition(false);
140
-
141
-        if ($description = $command->getDescription()) {
142
-            $this->writeText('<comment>Description:</comment>', $options);
143
-            $this->writeText("\n");
144
-            $this->writeText('  '.$description);
145
-            $this->writeText("\n\n");
146
-        }
147
-
148
-        $this->writeText('<comment>Usage:</comment>', $options);
149
-        foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) {
150
-            $this->writeText("\n");
151
-            $this->writeText('  '.OutputFormatter::escape($usage), $options);
152
-        }
153
-        $this->writeText("\n");
154
-
155
-        $definition = $command->getDefinition();
156
-        if ($definition->getOptions() || $definition->getArguments()) {
157
-            $this->writeText("\n");
158
-            $this->describeInputDefinition($definition, $options);
159
-            $this->writeText("\n");
160
-        }
161
-
162
-        $help = $command->getProcessedHelp();
163
-        if ($help && $help !== $description) {
164
-            $this->writeText("\n");
165
-            $this->writeText('<comment>Help:</comment>', $options);
166
-            $this->writeText("\n");
167
-            $this->writeText('  '.str_replace("\n", "\n  ", $help), $options);
168
-            $this->writeText("\n");
169
-        }
170
-    }
171
-
172
-    /**
173
-     * {@inheritdoc}
174
-     */
175
-    protected function describeApplication(Application $application, array $options = [])
176
-    {
177
-        $describedNamespace = $options['namespace'] ?? null;
178
-        $description = new ApplicationDescription($application, $describedNamespace);
179
-
180
-        if (isset($options['raw_text']) && $options['raw_text']) {
181
-            $width = $this->getColumnWidth($description->getCommands());
182
-
183
-            foreach ($description->getCommands() as $command) {
184
-                $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
185
-                $this->writeText("\n");
186
-            }
187
-        } else {
188
-            if ('' != $help = $application->getHelp()) {
189
-                $this->writeText("$help\n\n", $options);
190
-            }
191
-
192
-            $this->writeText("<comment>Usage:</comment>\n", $options);
193
-            $this->writeText("  command [options] [arguments]\n\n", $options);
194
-
195
-            $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
196
-
197
-            $this->writeText("\n");
198
-            $this->writeText("\n");
199
-
200
-            $commands = $description->getCommands();
201
-            $namespaces = $description->getNamespaces();
202
-            if ($describedNamespace && $namespaces) {
203
-                // make sure all alias commands are included when describing a specific namespace
204
-                $describedNamespaceInfo = reset($namespaces);
205
-                foreach ($describedNamespaceInfo['commands'] as $name) {
206
-                    $commands[$name] = $description->getCommand($name);
207
-                }
208
-            }
209
-
210
-            // calculate max. width based on available commands per namespace
211
-            $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) {
212
-                return array_intersect($namespace['commands'], array_keys($commands));
213
-            }, array_values($namespaces)))));
214
-
215
-            if ($describedNamespace) {
216
-                $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
217
-            } else {
218
-                $this->writeText('<comment>Available commands:</comment>', $options);
219
-            }
220
-
221
-            foreach ($namespaces as $namespace) {
222
-                $namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) {
223
-                    return isset($commands[$name]);
224
-                });
225
-
226
-                if (!$namespace['commands']) {
227
-                    continue;
228
-                }
229
-
230
-                if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
231
-                    $this->writeText("\n");
232
-                    $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
233
-                }
234
-
235
-                foreach ($namespace['commands'] as $name) {
236
-                    $this->writeText("\n");
237
-                    $spacingWidth = $width - Helper::width($name);
238
-                    $command = $commands[$name];
239
-                    $commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : '';
240
-                    $this->writeText(sprintf('  <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases.$command->getDescription()), $options);
241
-                }
242
-            }
243
-
244
-            $this->writeText("\n");
245
-        }
246
-    }
247
-
248
-    /**
249
-     * {@inheritdoc}
250
-     */
251
-    private function writeText(string $content, array $options = [])
252
-    {
253
-        $this->write(
254
-            isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
255
-            isset($options['raw_output']) ? !$options['raw_output'] : true
256
-        );
257
-    }
258
-
259
-    /**
260
-     * Formats command aliases to show them in the command description.
261
-     */
262
-    private function getCommandAliasesText(Command $command): string
263
-    {
264
-        $text = '';
265
-        $aliases = $command->getAliases();
266
-
267
-        if ($aliases) {
268
-            $text = '['.implode('|', $aliases).'] ';
269
-        }
270
-
271
-        return $text;
272
-    }
273
-
274
-    /**
275
-     * Formats input option/argument default value.
276
-     *
277
-     * @param mixed $default
278
-     */
279
-    private function formatDefaultValue($default): string
280
-    {
281
-        if (\INF === $default) {
282
-            return 'INF';
283
-        }
284
-
285
-        if (\is_string($default)) {
286
-            $default = OutputFormatter::escape($default);
287
-        } elseif (\is_array($default)) {
288
-            foreach ($default as $key => $value) {
289
-                if (\is_string($value)) {
290
-                    $default[$key] = OutputFormatter::escape($value);
291
-                }
292
-            }
293
-        }
294
-
295
-        return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
296
-    }
297
-
298
-    /**
299
-     * @param array<Command|string> $commands
300
-     */
301
-    private function getColumnWidth(array $commands): int
302
-    {
303
-        $widths = [];
304
-
305
-        foreach ($commands as $command) {
306
-            if ($command instanceof Command) {
307
-                $widths[] = Helper::width($command->getName());
308
-                foreach ($command->getAliases() as $alias) {
309
-                    $widths[] = Helper::width($alias);
310
-                }
311
-            } else {
312
-                $widths[] = Helper::width($command);
313
-            }
314
-        }
315
-
316
-        return $widths ? max($widths) + 2 : 0;
317
-    }
318
-
319
-    /**
320
-     * @param InputOption[] $options
321
-     */
322
-    private function calculateTotalWidthForOptions(array $options): int
323
-    {
324
-        $totalWidth = 0;
325
-        foreach ($options as $option) {
326
-            // "-" + shortcut + ", --" + name
327
-            $nameLength = 1 + max(Helper::width($option->getShortcut()), 1) + 4 + Helper::width($option->getName());
328
-            if ($option->isNegatable()) {
329
-                $nameLength += 6 + Helper::width($option->getName()); // |--no- + name
330
-            } elseif ($option->acceptValue()) {
331
-                $valueLength = 1 + Helper::width($option->getName()); // = + value
332
-                $valueLength += $option->isValueOptional() ? 2 : 0; // [ + ]
333
-
334
-                $nameLength += $valueLength;
335
-            }
336
-            $totalWidth = max($totalWidth, $nameLength);
337
-        }
338
-
339
-        return $totalWidth;
340
-    }
31
+	/**
32
+	 * {@inheritdoc}
33
+	 */
34
+	protected function describeInputArgument(InputArgument $argument, array $options = [])
35
+	{
36
+		if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
37
+			$default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
38
+		} else {
39
+			$default = '';
40
+		}
41
+
42
+		$totalWidth = $options['total_width'] ?? Helper::width($argument->getName());
43
+		$spacingWidth = $totalWidth - \strlen($argument->getName());
44
+
45
+		$this->writeText(sprintf('  <info>%s</info>  %s%s%s',
46
+			$argument->getName(),
47
+			str_repeat(' ', $spacingWidth),
48
+			// + 4 = 2 spaces before <info>, 2 spaces after </info>
49
+			preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
50
+			$default
51
+		), $options);
52
+	}
53
+
54
+	/**
55
+	 * {@inheritdoc}
56
+	 */
57
+	protected function describeInputOption(InputOption $option, array $options = [])
58
+	{
59
+		if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
60
+			$default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
61
+		} else {
62
+			$default = '';
63
+		}
64
+
65
+		$value = '';
66
+		if ($option->acceptValue()) {
67
+			$value = '='.strtoupper($option->getName());
68
+
69
+			if ($option->isValueOptional()) {
70
+				$value = '['.$value.']';
71
+			}
72
+		}
73
+
74
+		$totalWidth = $options['total_width'] ?? $this->calculateTotalWidthForOptions([$option]);
75
+		$synopsis = sprintf('%s%s',
76
+			$option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : '    ',
77
+			sprintf($option->isNegatable() ? '--%1$s|--no-%1$s' : '--%1$s%2$s', $option->getName(), $value)
78
+		);
79
+
80
+		$spacingWidth = $totalWidth - Helper::width($synopsis);
81
+
82
+		$this->writeText(sprintf('  <info>%s</info>  %s%s%s%s',
83
+			$synopsis,
84
+			str_repeat(' ', $spacingWidth),
85
+			// + 4 = 2 spaces before <info>, 2 spaces after </info>
86
+			preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
87
+			$default,
88
+			$option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
89
+		), $options);
90
+	}
91
+
92
+	/**
93
+	 * {@inheritdoc}
94
+	 */
95
+	protected function describeInputDefinition(InputDefinition $definition, array $options = [])
96
+	{
97
+		$totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
98
+		foreach ($definition->getArguments() as $argument) {
99
+			$totalWidth = max($totalWidth, Helper::width($argument->getName()));
100
+		}
101
+
102
+		if ($definition->getArguments()) {
103
+			$this->writeText('<comment>Arguments:</comment>', $options);
104
+			$this->writeText("\n");
105
+			foreach ($definition->getArguments() as $argument) {
106
+				$this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth]));
107
+				$this->writeText("\n");
108
+			}
109
+		}
110
+
111
+		if ($definition->getArguments() && $definition->getOptions()) {
112
+			$this->writeText("\n");
113
+		}
114
+
115
+		if ($definition->getOptions()) {
116
+			$laterOptions = [];
117
+
118
+			$this->writeText('<comment>Options:</comment>', $options);
119
+			foreach ($definition->getOptions() as $option) {
120
+				if (\strlen($option->getShortcut() ?? '') > 1) {
121
+					$laterOptions[] = $option;
122
+					continue;
123
+				}
124
+				$this->writeText("\n");
125
+				$this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
126
+			}
127
+			foreach ($laterOptions as $option) {
128
+				$this->writeText("\n");
129
+				$this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
130
+			}
131
+		}
132
+	}
133
+
134
+	/**
135
+	 * {@inheritdoc}
136
+	 */
137
+	protected function describeCommand(Command $command, array $options = [])
138
+	{
139
+		$command->mergeApplicationDefinition(false);
140
+
141
+		if ($description = $command->getDescription()) {
142
+			$this->writeText('<comment>Description:</comment>', $options);
143
+			$this->writeText("\n");
144
+			$this->writeText('  '.$description);
145
+			$this->writeText("\n\n");
146
+		}
147
+
148
+		$this->writeText('<comment>Usage:</comment>', $options);
149
+		foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) {
150
+			$this->writeText("\n");
151
+			$this->writeText('  '.OutputFormatter::escape($usage), $options);
152
+		}
153
+		$this->writeText("\n");
154
+
155
+		$definition = $command->getDefinition();
156
+		if ($definition->getOptions() || $definition->getArguments()) {
157
+			$this->writeText("\n");
158
+			$this->describeInputDefinition($definition, $options);
159
+			$this->writeText("\n");
160
+		}
161
+
162
+		$help = $command->getProcessedHelp();
163
+		if ($help && $help !== $description) {
164
+			$this->writeText("\n");
165
+			$this->writeText('<comment>Help:</comment>', $options);
166
+			$this->writeText("\n");
167
+			$this->writeText('  '.str_replace("\n", "\n  ", $help), $options);
168
+			$this->writeText("\n");
169
+		}
170
+	}
171
+
172
+	/**
173
+	 * {@inheritdoc}
174
+	 */
175
+	protected function describeApplication(Application $application, array $options = [])
176
+	{
177
+		$describedNamespace = $options['namespace'] ?? null;
178
+		$description = new ApplicationDescription($application, $describedNamespace);
179
+
180
+		if (isset($options['raw_text']) && $options['raw_text']) {
181
+			$width = $this->getColumnWidth($description->getCommands());
182
+
183
+			foreach ($description->getCommands() as $command) {
184
+				$this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
185
+				$this->writeText("\n");
186
+			}
187
+		} else {
188
+			if ('' != $help = $application->getHelp()) {
189
+				$this->writeText("$help\n\n", $options);
190
+			}
191
+
192
+			$this->writeText("<comment>Usage:</comment>\n", $options);
193
+			$this->writeText("  command [options] [arguments]\n\n", $options);
194
+
195
+			$this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
196
+
197
+			$this->writeText("\n");
198
+			$this->writeText("\n");
199
+
200
+			$commands = $description->getCommands();
201
+			$namespaces = $description->getNamespaces();
202
+			if ($describedNamespace && $namespaces) {
203
+				// make sure all alias commands are included when describing a specific namespace
204
+				$describedNamespaceInfo = reset($namespaces);
205
+				foreach ($describedNamespaceInfo['commands'] as $name) {
206
+					$commands[$name] = $description->getCommand($name);
207
+				}
208
+			}
209
+
210
+			// calculate max. width based on available commands per namespace
211
+			$width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) {
212
+				return array_intersect($namespace['commands'], array_keys($commands));
213
+			}, array_values($namespaces)))));
214
+
215
+			if ($describedNamespace) {
216
+				$this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
217
+			} else {
218
+				$this->writeText('<comment>Available commands:</comment>', $options);
219
+			}
220
+
221
+			foreach ($namespaces as $namespace) {
222
+				$namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) {
223
+					return isset($commands[$name]);
224
+				});
225
+
226
+				if (!$namespace['commands']) {
227
+					continue;
228
+				}
229
+
230
+				if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
231
+					$this->writeText("\n");
232
+					$this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
233
+				}
234
+
235
+				foreach ($namespace['commands'] as $name) {
236
+					$this->writeText("\n");
237
+					$spacingWidth = $width - Helper::width($name);
238
+					$command = $commands[$name];
239
+					$commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : '';
240
+					$this->writeText(sprintf('  <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases.$command->getDescription()), $options);
241
+				}
242
+			}
243
+
244
+			$this->writeText("\n");
245
+		}
246
+	}
247
+
248
+	/**
249
+	 * {@inheritdoc}
250
+	 */
251
+	private function writeText(string $content, array $options = [])
252
+	{
253
+		$this->write(
254
+			isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
255
+			isset($options['raw_output']) ? !$options['raw_output'] : true
256
+		);
257
+	}
258
+
259
+	/**
260
+	 * Formats command aliases to show them in the command description.
261
+	 */
262
+	private function getCommandAliasesText(Command $command): string
263
+	{
264
+		$text = '';
265
+		$aliases = $command->getAliases();
266
+
267
+		if ($aliases) {
268
+			$text = '['.implode('|', $aliases).'] ';
269
+		}
270
+
271
+		return $text;
272
+	}
273
+
274
+	/**
275
+	 * Formats input option/argument default value.
276
+	 *
277
+	 * @param mixed $default
278
+	 */
279
+	private function formatDefaultValue($default): string
280
+	{
281
+		if (\INF === $default) {
282
+			return 'INF';
283
+		}
284
+
285
+		if (\is_string($default)) {
286
+			$default = OutputFormatter::escape($default);
287
+		} elseif (\is_array($default)) {
288
+			foreach ($default as $key => $value) {
289
+				if (\is_string($value)) {
290
+					$default[$key] = OutputFormatter::escape($value);
291
+				}
292
+			}
293
+		}
294
+
295
+		return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
296
+	}
297
+
298
+	/**
299
+	 * @param array<Command|string> $commands
300
+	 */
301
+	private function getColumnWidth(array $commands): int
302
+	{
303
+		$widths = [];
304
+
305
+		foreach ($commands as $command) {
306
+			if ($command instanceof Command) {
307
+				$widths[] = Helper::width($command->getName());
308
+				foreach ($command->getAliases() as $alias) {
309
+					$widths[] = Helper::width($alias);
310
+				}
311
+			} else {
312
+				$widths[] = Helper::width($command);
313
+			}
314
+		}
315
+
316
+		return $widths ? max($widths) + 2 : 0;
317
+	}
318
+
319
+	/**
320
+	 * @param InputOption[] $options
321
+	 */
322
+	private function calculateTotalWidthForOptions(array $options): int
323
+	{
324
+		$totalWidth = 0;
325
+		foreach ($options as $option) {
326
+			// "-" + shortcut + ", --" + name
327
+			$nameLength = 1 + max(Helper::width($option->getShortcut()), 1) + 4 + Helper::width($option->getName());
328
+			if ($option->isNegatable()) {
329
+				$nameLength += 6 + Helper::width($option->getName()); // |--no- + name
330
+			} elseif ($option->acceptValue()) {
331
+				$valueLength = 1 + Helper::width($option->getName()); // = + value
332
+				$valueLength += $option->isValueOptional() ? 2 : 0; // [ + ]
333
+
334
+				$nameLength += $valueLength;
335
+			}
336
+			$totalWidth = max($totalWidth, $nameLength);
337
+		}
338
+
339
+		return $totalWidth;
340
+	}
341 341
 }
Please login to merge, or discard this patch.
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -31,102 +31,102 @@  discard block
 block discarded – undo
31 31
     /**
32 32
      * {@inheritdoc}
33 33
      */
34
-    protected function describeInputArgument(InputArgument $argument, array $options = [])
34
+    protected function describeInputArgument( InputArgument $argument, array $options = [ ] )
35 35
     {
36
-        if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
37
-            $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
36
+        if ( null !== $argument->getDefault() && ( ! \is_array( $argument->getDefault() ) || \count( $argument->getDefault() ) ) ) {
37
+            $default = sprintf( '<comment> [default: %s]</comment>', $this->formatDefaultValue( $argument->getDefault() ) );
38 38
         } else {
39 39
             $default = '';
40 40
         }
41 41
 
42
-        $totalWidth = $options['total_width'] ?? Helper::width($argument->getName());
43
-        $spacingWidth = $totalWidth - \strlen($argument->getName());
42
+        $totalWidth = $options[ 'total_width' ] ?? Helper::width( $argument->getName() );
43
+        $spacingWidth = $totalWidth - \strlen( $argument->getName() );
44 44
 
45
-        $this->writeText(sprintf('  <info>%s</info>  %s%s%s',
45
+        $this->writeText( sprintf( '  <info>%s</info>  %s%s%s',
46 46
             $argument->getName(),
47
-            str_repeat(' ', $spacingWidth),
47
+            str_repeat( ' ', $spacingWidth ),
48 48
             // + 4 = 2 spaces before <info>, 2 spaces after </info>
49
-            preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
49
+            preg_replace( '/\s*[\r\n]\s*/', "\n" . str_repeat( ' ', $totalWidth + 4 ), $argument->getDescription() ),
50 50
             $default
51
-        ), $options);
51
+        ), $options );
52 52
     }
53 53
 
54 54
     /**
55 55
      * {@inheritdoc}
56 56
      */
57
-    protected function describeInputOption(InputOption $option, array $options = [])
57
+    protected function describeInputOption( InputOption $option, array $options = [ ] )
58 58
     {
59
-        if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
60
-            $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
59
+        if ( $option->acceptValue() && null !== $option->getDefault() && ( ! \is_array( $option->getDefault() ) || \count( $option->getDefault() ) ) ) {
60
+            $default = sprintf( '<comment> [default: %s]</comment>', $this->formatDefaultValue( $option->getDefault() ) );
61 61
         } else {
62 62
             $default = '';
63 63
         }
64 64
 
65 65
         $value = '';
66
-        if ($option->acceptValue()) {
67
-            $value = '='.strtoupper($option->getName());
66
+        if ( $option->acceptValue() ) {
67
+            $value = '=' . strtoupper( $option->getName() );
68 68
 
69
-            if ($option->isValueOptional()) {
70
-                $value = '['.$value.']';
69
+            if ( $option->isValueOptional() ) {
70
+                $value = '[' . $value . ']';
71 71
             }
72 72
         }
73 73
 
74
-        $totalWidth = $options['total_width'] ?? $this->calculateTotalWidthForOptions([$option]);
75
-        $synopsis = sprintf('%s%s',
76
-            $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : '    ',
77
-            sprintf($option->isNegatable() ? '--%1$s|--no-%1$s' : '--%1$s%2$s', $option->getName(), $value)
74
+        $totalWidth = $options[ 'total_width' ] ?? $this->calculateTotalWidthForOptions( [ $option ] );
75
+        $synopsis = sprintf( '%s%s',
76
+            $option->getShortcut() ? sprintf( '-%s, ', $option->getShortcut() ) : '    ',
77
+            sprintf( $option->isNegatable() ? '--%1$s|--no-%1$s' : '--%1$s%2$s', $option->getName(), $value )
78 78
         );
79 79
 
80
-        $spacingWidth = $totalWidth - Helper::width($synopsis);
80
+        $spacingWidth = $totalWidth - Helper::width( $synopsis );
81 81
 
82
-        $this->writeText(sprintf('  <info>%s</info>  %s%s%s%s',
82
+        $this->writeText( sprintf( '  <info>%s</info>  %s%s%s%s',
83 83
             $synopsis,
84
-            str_repeat(' ', $spacingWidth),
84
+            str_repeat( ' ', $spacingWidth ),
85 85
             // + 4 = 2 spaces before <info>, 2 spaces after </info>
86
-            preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
86
+            preg_replace( '/\s*[\r\n]\s*/', "\n" . str_repeat( ' ', $totalWidth + 4 ), $option->getDescription() ),
87 87
             $default,
88 88
             $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
89
-        ), $options);
89
+        ), $options );
90 90
     }
91 91
 
92 92
     /**
93 93
      * {@inheritdoc}
94 94
      */
95
-    protected function describeInputDefinition(InputDefinition $definition, array $options = [])
95
+    protected function describeInputDefinition( InputDefinition $definition, array $options = [ ] )
96 96
     {
97
-        $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
98
-        foreach ($definition->getArguments() as $argument) {
99
-            $totalWidth = max($totalWidth, Helper::width($argument->getName()));
97
+        $totalWidth = $this->calculateTotalWidthForOptions( $definition->getOptions() );
98
+        foreach ( $definition->getArguments() as $argument ) {
99
+            $totalWidth = max( $totalWidth, Helper::width( $argument->getName() ) );
100 100
         }
101 101
 
102
-        if ($definition->getArguments()) {
103
-            $this->writeText('<comment>Arguments:</comment>', $options);
104
-            $this->writeText("\n");
105
-            foreach ($definition->getArguments() as $argument) {
106
-                $this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth]));
107
-                $this->writeText("\n");
102
+        if ( $definition->getArguments() ) {
103
+            $this->writeText( '<comment>Arguments:</comment>', $options );
104
+            $this->writeText( "\n" );
105
+            foreach ( $definition->getArguments() as $argument ) {
106
+                $this->describeInputArgument( $argument, array_merge( $options, [ 'total_width' => $totalWidth ] ) );
107
+                $this->writeText( "\n" );
108 108
             }
109 109
         }
110 110
 
111
-        if ($definition->getArguments() && $definition->getOptions()) {
112
-            $this->writeText("\n");
111
+        if ( $definition->getArguments() && $definition->getOptions() ) {
112
+            $this->writeText( "\n" );
113 113
         }
114 114
 
115
-        if ($definition->getOptions()) {
116
-            $laterOptions = [];
115
+        if ( $definition->getOptions() ) {
116
+            $laterOptions = [ ];
117 117
 
118
-            $this->writeText('<comment>Options:</comment>', $options);
119
-            foreach ($definition->getOptions() as $option) {
120
-                if (\strlen($option->getShortcut() ?? '') > 1) {
121
-                    $laterOptions[] = $option;
118
+            $this->writeText( '<comment>Options:</comment>', $options );
119
+            foreach ( $definition->getOptions() as $option ) {
120
+                if ( \strlen( $option->getShortcut() ?? '' ) > 1 ) {
121
+                    $laterOptions[ ] = $option;
122 122
                     continue;
123 123
                 }
124
-                $this->writeText("\n");
125
-                $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
124
+                $this->writeText( "\n" );
125
+                $this->describeInputOption( $option, array_merge( $options, [ 'total_width' => $totalWidth ] ) );
126 126
             }
127
-            foreach ($laterOptions as $option) {
128
-                $this->writeText("\n");
129
-                $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
127
+            foreach ( $laterOptions as $option ) {
128
+                $this->writeText( "\n" );
129
+                $this->describeInputOption( $option, array_merge( $options, [ 'total_width' => $totalWidth ] ) );
130 130
             }
131 131
         }
132 132
     }
@@ -134,138 +134,138 @@  discard block
 block discarded – undo
134 134
     /**
135 135
      * {@inheritdoc}
136 136
      */
137
-    protected function describeCommand(Command $command, array $options = [])
137
+    protected function describeCommand( Command $command, array $options = [ ] )
138 138
     {
139
-        $command->mergeApplicationDefinition(false);
139
+        $command->mergeApplicationDefinition( false );
140 140
 
141
-        if ($description = $command->getDescription()) {
142
-            $this->writeText('<comment>Description:</comment>', $options);
143
-            $this->writeText("\n");
144
-            $this->writeText('  '.$description);
145
-            $this->writeText("\n\n");
141
+        if ( $description = $command->getDescription() ) {
142
+            $this->writeText( '<comment>Description:</comment>', $options );
143
+            $this->writeText( "\n" );
144
+            $this->writeText( '  ' . $description );
145
+            $this->writeText( "\n\n" );
146 146
         }
147 147
 
148
-        $this->writeText('<comment>Usage:</comment>', $options);
149
-        foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) {
150
-            $this->writeText("\n");
151
-            $this->writeText('  '.OutputFormatter::escape($usage), $options);
148
+        $this->writeText( '<comment>Usage:</comment>', $options );
149
+        foreach ( array_merge( [ $command->getSynopsis( true ) ], $command->getAliases(), $command->getUsages() ) as $usage ) {
150
+            $this->writeText( "\n" );
151
+            $this->writeText( '  ' . OutputFormatter::escape( $usage ), $options );
152 152
         }
153
-        $this->writeText("\n");
153
+        $this->writeText( "\n" );
154 154
 
155 155
         $definition = $command->getDefinition();
156
-        if ($definition->getOptions() || $definition->getArguments()) {
157
-            $this->writeText("\n");
158
-            $this->describeInputDefinition($definition, $options);
159
-            $this->writeText("\n");
156
+        if ( $definition->getOptions() || $definition->getArguments() ) {
157
+            $this->writeText( "\n" );
158
+            $this->describeInputDefinition( $definition, $options );
159
+            $this->writeText( "\n" );
160 160
         }
161 161
 
162 162
         $help = $command->getProcessedHelp();
163
-        if ($help && $help !== $description) {
164
-            $this->writeText("\n");
165
-            $this->writeText('<comment>Help:</comment>', $options);
166
-            $this->writeText("\n");
167
-            $this->writeText('  '.str_replace("\n", "\n  ", $help), $options);
168
-            $this->writeText("\n");
163
+        if ( $help && $help !== $description ) {
164
+            $this->writeText( "\n" );
165
+            $this->writeText( '<comment>Help:</comment>', $options );
166
+            $this->writeText( "\n" );
167
+            $this->writeText( '  ' . str_replace( "\n", "\n  ", $help ), $options );
168
+            $this->writeText( "\n" );
169 169
         }
170 170
     }
171 171
 
172 172
     /**
173 173
      * {@inheritdoc}
174 174
      */
175
-    protected function describeApplication(Application $application, array $options = [])
175
+    protected function describeApplication( Application $application, array $options = [ ] )
176 176
     {
177
-        $describedNamespace = $options['namespace'] ?? null;
178
-        $description = new ApplicationDescription($application, $describedNamespace);
177
+        $describedNamespace = $options[ 'namespace' ] ?? null;
178
+        $description = new ApplicationDescription( $application, $describedNamespace );
179 179
 
180
-        if (isset($options['raw_text']) && $options['raw_text']) {
181
-            $width = $this->getColumnWidth($description->getCommands());
180
+        if ( isset( $options[ 'raw_text' ] ) && $options[ 'raw_text' ] ) {
181
+            $width = $this->getColumnWidth( $description->getCommands() );
182 182
 
183
-            foreach ($description->getCommands() as $command) {
184
-                $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
185
-                $this->writeText("\n");
183
+            foreach ( $description->getCommands() as $command ) {
184
+                $this->writeText( sprintf( "%-{$width}s %s", $command->getName(), $command->getDescription() ), $options );
185
+                $this->writeText( "\n" );
186 186
             }
187 187
         } else {
188
-            if ('' != $help = $application->getHelp()) {
189
-                $this->writeText("$help\n\n", $options);
188
+            if ( '' != $help = $application->getHelp() ) {
189
+                $this->writeText( "$help\n\n", $options );
190 190
             }
191 191
 
192
-            $this->writeText("<comment>Usage:</comment>\n", $options);
193
-            $this->writeText("  command [options] [arguments]\n\n", $options);
192
+            $this->writeText( "<comment>Usage:</comment>\n", $options );
193
+            $this->writeText( "  command [options] [arguments]\n\n", $options );
194 194
 
195
-            $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
195
+            $this->describeInputDefinition( new InputDefinition( $application->getDefinition()->getOptions() ), $options );
196 196
 
197
-            $this->writeText("\n");
198
-            $this->writeText("\n");
197
+            $this->writeText( "\n" );
198
+            $this->writeText( "\n" );
199 199
 
200 200
             $commands = $description->getCommands();
201 201
             $namespaces = $description->getNamespaces();
202
-            if ($describedNamespace && $namespaces) {
202
+            if ( $describedNamespace && $namespaces ) {
203 203
                 // make sure all alias commands are included when describing a specific namespace
204
-                $describedNamespaceInfo = reset($namespaces);
205
-                foreach ($describedNamespaceInfo['commands'] as $name) {
206
-                    $commands[$name] = $description->getCommand($name);
204
+                $describedNamespaceInfo = reset( $namespaces );
205
+                foreach ( $describedNamespaceInfo[ 'commands' ] as $name ) {
206
+                    $commands[ $name ] = $description->getCommand( $name );
207 207
                 }
208 208
             }
209 209
 
210 210
             // calculate max. width based on available commands per namespace
211
-            $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) {
212
-                return array_intersect($namespace['commands'], array_keys($commands));
213
-            }, array_values($namespaces)))));
211
+            $width = $this->getColumnWidth( array_merge( ...array_values( array_map( function( $namespace ) use ( $commands ) {
212
+                return array_intersect( $namespace[ 'commands' ], array_keys( $commands ) );
213
+            }, array_values( $namespaces ) ) ) ) );
214 214
 
215
-            if ($describedNamespace) {
216
-                $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
215
+            if ( $describedNamespace ) {
216
+                $this->writeText( sprintf( '<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace ), $options );
217 217
             } else {
218
-                $this->writeText('<comment>Available commands:</comment>', $options);
218
+                $this->writeText( '<comment>Available commands:</comment>', $options );
219 219
             }
220 220
 
221
-            foreach ($namespaces as $namespace) {
222
-                $namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) {
223
-                    return isset($commands[$name]);
221
+            foreach ( $namespaces as $namespace ) {
222
+                $namespace[ 'commands' ] = array_filter( $namespace[ 'commands' ], function( $name ) use ( $commands ) {
223
+                    return isset( $commands[ $name ] );
224 224
                 });
225 225
 
226
-                if (!$namespace['commands']) {
226
+                if ( ! $namespace[ 'commands' ] ) {
227 227
                     continue;
228 228
                 }
229 229
 
230
-                if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
231
-                    $this->writeText("\n");
232
-                    $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
230
+                if ( ! $describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace[ 'id' ] ) {
231
+                    $this->writeText( "\n" );
232
+                    $this->writeText( ' <comment>' . $namespace[ 'id' ] . '</comment>', $options );
233 233
                 }
234 234
 
235
-                foreach ($namespace['commands'] as $name) {
236
-                    $this->writeText("\n");
237
-                    $spacingWidth = $width - Helper::width($name);
238
-                    $command = $commands[$name];
239
-                    $commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : '';
240
-                    $this->writeText(sprintf('  <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases.$command->getDescription()), $options);
235
+                foreach ( $namespace[ 'commands' ] as $name ) {
236
+                    $this->writeText( "\n" );
237
+                    $spacingWidth = $width - Helper::width( $name );
238
+                    $command = $commands[ $name ];
239
+                    $commandAliases = $name === $command->getName() ? $this->getCommandAliasesText( $command ) : '';
240
+                    $this->writeText( sprintf( '  <info>%s</info>%s%s', $name, str_repeat( ' ', $spacingWidth ), $commandAliases . $command->getDescription() ), $options );
241 241
                 }
242 242
             }
243 243
 
244
-            $this->writeText("\n");
244
+            $this->writeText( "\n" );
245 245
         }
246 246
     }
247 247
 
248 248
     /**
249 249
      * {@inheritdoc}
250 250
      */
251
-    private function writeText(string $content, array $options = [])
251
+    private function writeText( string $content, array $options = [ ] )
252 252
     {
253 253
         $this->write(
254
-            isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
255
-            isset($options['raw_output']) ? !$options['raw_output'] : true
254
+            isset( $options[ 'raw_text' ] ) && $options[ 'raw_text' ] ? strip_tags( $content ) : $content,
255
+            isset( $options[ 'raw_output' ] ) ? ! $options[ 'raw_output' ] : true
256 256
         );
257 257
     }
258 258
 
259 259
     /**
260 260
      * Formats command aliases to show them in the command description.
261 261
      */
262
-    private function getCommandAliasesText(Command $command): string
262
+    private function getCommandAliasesText( Command $command ): string
263 263
     {
264 264
         $text = '';
265 265
         $aliases = $command->getAliases();
266 266
 
267
-        if ($aliases) {
268
-            $text = '['.implode('|', $aliases).'] ';
267
+        if ( $aliases ) {
268
+            $text = '[' . implode( '|', $aliases ) . '] ';
269 269
         }
270 270
 
271 271
         return $text;
@@ -276,64 +276,64 @@  discard block
 block discarded – undo
276 276
      *
277 277
      * @param mixed $default
278 278
      */
279
-    private function formatDefaultValue($default): string
279
+    private function formatDefaultValue( $default ): string
280 280
     {
281
-        if (\INF === $default) {
281
+        if ( \INF === $default ) {
282 282
             return 'INF';
283 283
         }
284 284
 
285
-        if (\is_string($default)) {
286
-            $default = OutputFormatter::escape($default);
287
-        } elseif (\is_array($default)) {
288
-            foreach ($default as $key => $value) {
289
-                if (\is_string($value)) {
290
-                    $default[$key] = OutputFormatter::escape($value);
285
+        if ( \is_string( $default ) ) {
286
+            $default = OutputFormatter::escape( $default );
287
+        } elseif ( \is_array( $default ) ) {
288
+            foreach ( $default as $key => $value ) {
289
+                if ( \is_string( $value ) ) {
290
+                    $default[ $key ] = OutputFormatter::escape( $value );
291 291
                 }
292 292
             }
293 293
         }
294 294
 
295
-        return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
295
+        return str_replace( '\\\\', '\\', json_encode( $default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE ) );
296 296
     }
297 297
 
298 298
     /**
299 299
      * @param array<Command|string> $commands
300 300
      */
301
-    private function getColumnWidth(array $commands): int
301
+    private function getColumnWidth( array $commands ): int
302 302
     {
303
-        $widths = [];
303
+        $widths = [ ];
304 304
 
305
-        foreach ($commands as $command) {
306
-            if ($command instanceof Command) {
307
-                $widths[] = Helper::width($command->getName());
308
-                foreach ($command->getAliases() as $alias) {
309
-                    $widths[] = Helper::width($alias);
305
+        foreach ( $commands as $command ) {
306
+            if ( $command instanceof Command ) {
307
+                $widths[ ] = Helper::width( $command->getName() );
308
+                foreach ( $command->getAliases() as $alias ) {
309
+                    $widths[ ] = Helper::width( $alias );
310 310
                 }
311 311
             } else {
312
-                $widths[] = Helper::width($command);
312
+                $widths[ ] = Helper::width( $command );
313 313
             }
314 314
         }
315 315
 
316
-        return $widths ? max($widths) + 2 : 0;
316
+        return $widths ? max( $widths ) + 2 : 0;
317 317
     }
318 318
 
319 319
     /**
320 320
      * @param InputOption[] $options
321 321
      */
322
-    private function calculateTotalWidthForOptions(array $options): int
322
+    private function calculateTotalWidthForOptions( array $options ): int
323 323
     {
324 324
         $totalWidth = 0;
325
-        foreach ($options as $option) {
325
+        foreach ( $options as $option ) {
326 326
             // "-" + shortcut + ", --" + name
327
-            $nameLength = 1 + max(Helper::width($option->getShortcut()), 1) + 4 + Helper::width($option->getName());
328
-            if ($option->isNegatable()) {
329
-                $nameLength += 6 + Helper::width($option->getName()); // |--no- + name
330
-            } elseif ($option->acceptValue()) {
331
-                $valueLength = 1 + Helper::width($option->getName()); // = + value
327
+            $nameLength = 1 + max( Helper::width( $option->getShortcut() ), 1 ) + 4 + Helper::width( $option->getName() );
328
+            if ( $option->isNegatable() ) {
329
+                $nameLength += 6 + Helper::width( $option->getName() ); // |--no- + name
330
+            } elseif ( $option->acceptValue() ) {
331
+                $valueLength = 1 + Helper::width( $option->getName() ); // = + value
332 332
                 $valueLength += $option->isValueOptional() ? 2 : 0; // [ + ]
333 333
 
334 334
                 $nameLength += $valueLength;
335 335
             }
336
-            $totalWidth = max($totalWidth, $nameLength);
336
+            $totalWidth = max( $totalWidth, $nameLength );
337 337
         }
338 338
 
339 339
         return $totalWidth;
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,13 +26,11 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @internal
28 28
  */
29
-class TextDescriptor extends Descriptor
30
-{
29
+class TextDescriptor extends Descriptor {
31 30
     /**
32 31
      * {@inheritdoc}
33 32
      */
34
-    protected function describeInputArgument(InputArgument $argument, array $options = [])
35
-    {
33
+    protected function describeInputArgument(InputArgument $argument, array $options = []) {
36 34
         if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
37 35
             $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
38 36
         } else {
@@ -54,8 +52,7 @@  discard block
 block discarded – undo
54 52
     /**
55 53
      * {@inheritdoc}
56 54
      */
57
-    protected function describeInputOption(InputOption $option, array $options = [])
58
-    {
55
+    protected function describeInputOption(InputOption $option, array $options = []) {
59 56
         if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
60 57
             $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
61 58
         } else {
@@ -92,8 +89,7 @@  discard block
 block discarded – undo
92 89
     /**
93 90
      * {@inheritdoc}
94 91
      */
95
-    protected function describeInputDefinition(InputDefinition $definition, array $options = [])
96
-    {
92
+    protected function describeInputDefinition(InputDefinition $definition, array $options = []) {
97 93
         $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
98 94
         foreach ($definition->getArguments() as $argument) {
99 95
             $totalWidth = max($totalWidth, Helper::width($argument->getName()));
@@ -134,8 +130,7 @@  discard block
 block discarded – undo
134 130
     /**
135 131
      * {@inheritdoc}
136 132
      */
137
-    protected function describeCommand(Command $command, array $options = [])
138
-    {
133
+    protected function describeCommand(Command $command, array $options = []) {
139 134
         $command->mergeApplicationDefinition(false);
140 135
 
141 136
         if ($description = $command->getDescription()) {
@@ -172,8 +167,7 @@  discard block
 block discarded – undo
172 167
     /**
173 168
      * {@inheritdoc}
174 169
      */
175
-    protected function describeApplication(Application $application, array $options = [])
176
-    {
170
+    protected function describeApplication(Application $application, array $options = []) {
177 171
         $describedNamespace = $options['namespace'] ?? null;
178 172
         $description = new ApplicationDescription($application, $describedNamespace);
179 173
 
@@ -248,8 +242,7 @@  discard block
 block discarded – undo
248 242
     /**
249 243
      * {@inheritdoc}
250 244
      */
251
-    private function writeText(string $content, array $options = [])
252
-    {
245
+    private function writeText(string $content, array $options = []) {
253 246
         $this->write(
254 247
             isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
255 248
             isset($options['raw_output']) ? !$options['raw_output'] : true
Please login to merge, or discard this patch.
vendor/symfony/console/Descriptor/MarkdownDescriptor.php 3 patches
Indentation   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -28,179 +28,179 @@
 block discarded – undo
28 28
  */
29 29
 class MarkdownDescriptor extends Descriptor
30 30
 {
31
-    /**
32
-     * {@inheritdoc}
33
-     */
34
-    public function describe(OutputInterface $output, object $object, array $options = [])
35
-    {
36
-        $decorated = $output->isDecorated();
37
-        $output->setDecorated(false);
38
-
39
-        parent::describe($output, $object, $options);
40
-
41
-        $output->setDecorated($decorated);
42
-    }
43
-
44
-    /**
45
-     * {@inheritdoc}
46
-     */
47
-    protected function write(string $content, bool $decorated = true)
48
-    {
49
-        parent::write($content, $decorated);
50
-    }
51
-
52
-    /**
53
-     * {@inheritdoc}
54
-     */
55
-    protected function describeInputArgument(InputArgument $argument, array $options = [])
56
-    {
57
-        $this->write(
58
-            '#### `'.($argument->getName() ?: '<none>')."`\n\n"
59
-            .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '')
60
-            .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
61
-            .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
62
-            .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
63
-        );
64
-    }
65
-
66
-    /**
67
-     * {@inheritdoc}
68
-     */
69
-    protected function describeInputOption(InputOption $option, array $options = [])
70
-    {
71
-        $name = '--'.$option->getName();
72
-        if ($option->isNegatable()) {
73
-            $name .= '|--no-'.$option->getName();
74
-        }
75
-        if ($option->getShortcut()) {
76
-            $name .= '|-'.str_replace('|', '|-', $option->getShortcut()).'';
77
-        }
78
-
79
-        $this->write(
80
-            '#### `'.$name.'`'."\n\n"
81
-            .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription())."\n\n" : '')
82
-            .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
83
-            .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
84
-            .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
85
-            .'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n"
86
-            .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
87
-        );
88
-    }
89
-
90
-    /**
91
-     * {@inheritdoc}
92
-     */
93
-    protected function describeInputDefinition(InputDefinition $definition, array $options = [])
94
-    {
95
-        if ($showArguments = \count($definition->getArguments()) > 0) {
96
-            $this->write('### Arguments');
97
-            foreach ($definition->getArguments() as $argument) {
98
-                $this->write("\n\n");
99
-                if (null !== $describeInputArgument = $this->describeInputArgument($argument)) {
100
-                    $this->write($describeInputArgument);
101
-                }
102
-            }
103
-        }
104
-
105
-        if (\count($definition->getOptions()) > 0) {
106
-            if ($showArguments) {
107
-                $this->write("\n\n");
108
-            }
109
-
110
-            $this->write('### Options');
111
-            foreach ($definition->getOptions() as $option) {
112
-                $this->write("\n\n");
113
-                if (null !== $describeInputOption = $this->describeInputOption($option)) {
114
-                    $this->write($describeInputOption);
115
-                }
116
-            }
117
-        }
118
-    }
119
-
120
-    /**
121
-     * {@inheritdoc}
122
-     */
123
-    protected function describeCommand(Command $command, array $options = [])
124
-    {
125
-        if ($options['short'] ?? false) {
126
-            $this->write(
127
-                '`'.$command->getName()."`\n"
128
-                .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
129
-                .($command->getDescription() ? $command->getDescription()."\n\n" : '')
130
-                .'### Usage'."\n\n"
131
-                .array_reduce($command->getAliases(), function ($carry, $usage) {
132
-                    return $carry.'* `'.$usage.'`'."\n";
133
-                })
134
-            );
135
-
136
-            return;
137
-        }
138
-
139
-        $command->mergeApplicationDefinition(false);
140
-
141
-        $this->write(
142
-            '`'.$command->getName()."`\n"
143
-            .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
144
-            .($command->getDescription() ? $command->getDescription()."\n\n" : '')
145
-            .'### Usage'."\n\n"
146
-            .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
147
-                return $carry.'* `'.$usage.'`'."\n";
148
-            })
149
-        );
150
-
151
-        if ($help = $command->getProcessedHelp()) {
152
-            $this->write("\n");
153
-            $this->write($help);
154
-        }
155
-
156
-        $definition = $command->getDefinition();
157
-        if ($definition->getOptions() || $definition->getArguments()) {
158
-            $this->write("\n\n");
159
-            $this->describeInputDefinition($definition);
160
-        }
161
-    }
162
-
163
-    /**
164
-     * {@inheritdoc}
165
-     */
166
-    protected function describeApplication(Application $application, array $options = [])
167
-    {
168
-        $describedNamespace = $options['namespace'] ?? null;
169
-        $description = new ApplicationDescription($application, $describedNamespace);
170
-        $title = $this->getApplicationTitle($application);
171
-
172
-        $this->write($title."\n".str_repeat('=', Helper::width($title)));
173
-
174
-        foreach ($description->getNamespaces() as $namespace) {
175
-            if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
176
-                $this->write("\n\n");
177
-                $this->write('**'.$namespace['id'].':**');
178
-            }
179
-
180
-            $this->write("\n\n");
181
-            $this->write(implode("\n", array_map(function ($commandName) use ($description) {
182
-                return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName()));
183
-            }, $namespace['commands'])));
184
-        }
185
-
186
-        foreach ($description->getCommands() as $command) {
187
-            $this->write("\n\n");
188
-            if (null !== $describeCommand = $this->describeCommand($command, $options)) {
189
-                $this->write($describeCommand);
190
-            }
191
-        }
192
-    }
193
-
194
-    private function getApplicationTitle(Application $application): string
195
-    {
196
-        if ('UNKNOWN' !== $application->getName()) {
197
-            if ('UNKNOWN' !== $application->getVersion()) {
198
-                return sprintf('%s %s', $application->getName(), $application->getVersion());
199
-            }
200
-
201
-            return $application->getName();
202
-        }
203
-
204
-        return 'Console Tool';
205
-    }
31
+	/**
32
+	 * {@inheritdoc}
33
+	 */
34
+	public function describe(OutputInterface $output, object $object, array $options = [])
35
+	{
36
+		$decorated = $output->isDecorated();
37
+		$output->setDecorated(false);
38
+
39
+		parent::describe($output, $object, $options);
40
+
41
+		$output->setDecorated($decorated);
42
+	}
43
+
44
+	/**
45
+	 * {@inheritdoc}
46
+	 */
47
+	protected function write(string $content, bool $decorated = true)
48
+	{
49
+		parent::write($content, $decorated);
50
+	}
51
+
52
+	/**
53
+	 * {@inheritdoc}
54
+	 */
55
+	protected function describeInputArgument(InputArgument $argument, array $options = [])
56
+	{
57
+		$this->write(
58
+			'#### `'.($argument->getName() ?: '<none>')."`\n\n"
59
+			.($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '')
60
+			.'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
61
+			.'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
62
+			.'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
63
+		);
64
+	}
65
+
66
+	/**
67
+	 * {@inheritdoc}
68
+	 */
69
+	protected function describeInputOption(InputOption $option, array $options = [])
70
+	{
71
+		$name = '--'.$option->getName();
72
+		if ($option->isNegatable()) {
73
+			$name .= '|--no-'.$option->getName();
74
+		}
75
+		if ($option->getShortcut()) {
76
+			$name .= '|-'.str_replace('|', '|-', $option->getShortcut()).'';
77
+		}
78
+
79
+		$this->write(
80
+			'#### `'.$name.'`'."\n\n"
81
+			.($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription())."\n\n" : '')
82
+			.'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
83
+			.'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
84
+			.'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
85
+			.'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n"
86
+			.'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
87
+		);
88
+	}
89
+
90
+	/**
91
+	 * {@inheritdoc}
92
+	 */
93
+	protected function describeInputDefinition(InputDefinition $definition, array $options = [])
94
+	{
95
+		if ($showArguments = \count($definition->getArguments()) > 0) {
96
+			$this->write('### Arguments');
97
+			foreach ($definition->getArguments() as $argument) {
98
+				$this->write("\n\n");
99
+				if (null !== $describeInputArgument = $this->describeInputArgument($argument)) {
100
+					$this->write($describeInputArgument);
101
+				}
102
+			}
103
+		}
104
+
105
+		if (\count($definition->getOptions()) > 0) {
106
+			if ($showArguments) {
107
+				$this->write("\n\n");
108
+			}
109
+
110
+			$this->write('### Options');
111
+			foreach ($definition->getOptions() as $option) {
112
+				$this->write("\n\n");
113
+				if (null !== $describeInputOption = $this->describeInputOption($option)) {
114
+					$this->write($describeInputOption);
115
+				}
116
+			}
117
+		}
118
+	}
119
+
120
+	/**
121
+	 * {@inheritdoc}
122
+	 */
123
+	protected function describeCommand(Command $command, array $options = [])
124
+	{
125
+		if ($options['short'] ?? false) {
126
+			$this->write(
127
+				'`'.$command->getName()."`\n"
128
+				.str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
129
+				.($command->getDescription() ? $command->getDescription()."\n\n" : '')
130
+				.'### Usage'."\n\n"
131
+				.array_reduce($command->getAliases(), function ($carry, $usage) {
132
+					return $carry.'* `'.$usage.'`'."\n";
133
+				})
134
+			);
135
+
136
+			return;
137
+		}
138
+
139
+		$command->mergeApplicationDefinition(false);
140
+
141
+		$this->write(
142
+			'`'.$command->getName()."`\n"
143
+			.str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
144
+			.($command->getDescription() ? $command->getDescription()."\n\n" : '')
145
+			.'### Usage'."\n\n"
146
+			.array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
147
+				return $carry.'* `'.$usage.'`'."\n";
148
+			})
149
+		);
150
+
151
+		if ($help = $command->getProcessedHelp()) {
152
+			$this->write("\n");
153
+			$this->write($help);
154
+		}
155
+
156
+		$definition = $command->getDefinition();
157
+		if ($definition->getOptions() || $definition->getArguments()) {
158
+			$this->write("\n\n");
159
+			$this->describeInputDefinition($definition);
160
+		}
161
+	}
162
+
163
+	/**
164
+	 * {@inheritdoc}
165
+	 */
166
+	protected function describeApplication(Application $application, array $options = [])
167
+	{
168
+		$describedNamespace = $options['namespace'] ?? null;
169
+		$description = new ApplicationDescription($application, $describedNamespace);
170
+		$title = $this->getApplicationTitle($application);
171
+
172
+		$this->write($title."\n".str_repeat('=', Helper::width($title)));
173
+
174
+		foreach ($description->getNamespaces() as $namespace) {
175
+			if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
176
+				$this->write("\n\n");
177
+				$this->write('**'.$namespace['id'].':**');
178
+			}
179
+
180
+			$this->write("\n\n");
181
+			$this->write(implode("\n", array_map(function ($commandName) use ($description) {
182
+				return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName()));
183
+			}, $namespace['commands'])));
184
+		}
185
+
186
+		foreach ($description->getCommands() as $command) {
187
+			$this->write("\n\n");
188
+			if (null !== $describeCommand = $this->describeCommand($command, $options)) {
189
+				$this->write($describeCommand);
190
+			}
191
+		}
192
+	}
193
+
194
+	private function getApplicationTitle(Application $application): string
195
+	{
196
+		if ('UNKNOWN' !== $application->getName()) {
197
+			if ('UNKNOWN' !== $application->getVersion()) {
198
+				return sprintf('%s %s', $application->getName(), $application->getVersion());
199
+			}
200
+
201
+			return $application->getName();
202
+		}
203
+
204
+		return 'Console Tool';
205
+	}
206 206
 }
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -31,87 +31,87 @@  discard block
 block discarded – undo
31 31
     /**
32 32
      * {@inheritdoc}
33 33
      */
34
-    public function describe(OutputInterface $output, object $object, array $options = [])
34
+    public function describe( OutputInterface $output, object $object, array $options = [ ] )
35 35
     {
36 36
         $decorated = $output->isDecorated();
37
-        $output->setDecorated(false);
37
+        $output->setDecorated( false );
38 38
 
39
-        parent::describe($output, $object, $options);
39
+        parent::describe( $output, $object, $options );
40 40
 
41
-        $output->setDecorated($decorated);
41
+        $output->setDecorated( $decorated );
42 42
     }
43 43
 
44 44
     /**
45 45
      * {@inheritdoc}
46 46
      */
47
-    protected function write(string $content, bool $decorated = true)
47
+    protected function write( string $content, bool $decorated = true )
48 48
     {
49
-        parent::write($content, $decorated);
49
+        parent::write( $content, $decorated );
50 50
     }
51 51
 
52 52
     /**
53 53
      * {@inheritdoc}
54 54
      */
55
-    protected function describeInputArgument(InputArgument $argument, array $options = [])
55
+    protected function describeInputArgument( InputArgument $argument, array $options = [ ] )
56 56
     {
57 57
         $this->write(
58
-            '#### `'.($argument->getName() ?: '<none>')."`\n\n"
59
-            .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '')
60
-            .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
61
-            .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
62
-            .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
58
+            '#### `' . ( $argument->getName() ?: '<none>' ) . "`\n\n"
59
+            .( $argument->getDescription() ? preg_replace( '/\s*[\r\n]\s*/', "\n", $argument->getDescription() ) . "\n\n" : '' )
60
+            .'* Is required: ' . ( $argument->isRequired() ? 'yes' : 'no' ) . "\n"
61
+            .'* Is array: ' . ( $argument->isArray() ? 'yes' : 'no' ) . "\n"
62
+            .'* Default: `' . str_replace( "\n", '', var_export( $argument->getDefault(), true ) ) . '`'
63 63
         );
64 64
     }
65 65
 
66 66
     /**
67 67
      * {@inheritdoc}
68 68
      */
69
-    protected function describeInputOption(InputOption $option, array $options = [])
69
+    protected function describeInputOption( InputOption $option, array $options = [ ] )
70 70
     {
71
-        $name = '--'.$option->getName();
72
-        if ($option->isNegatable()) {
73
-            $name .= '|--no-'.$option->getName();
71
+        $name = '--' . $option->getName();
72
+        if ( $option->isNegatable() ) {
73
+            $name .= '|--no-' . $option->getName();
74 74
         }
75
-        if ($option->getShortcut()) {
76
-            $name .= '|-'.str_replace('|', '|-', $option->getShortcut()).'';
75
+        if ( $option->getShortcut() ) {
76
+            $name .= '|-' . str_replace( '|', '|-', $option->getShortcut() ) . '';
77 77
         }
78 78
 
79 79
         $this->write(
80
-            '#### `'.$name.'`'."\n\n"
81
-            .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription())."\n\n" : '')
82
-            .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
83
-            .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
84
-            .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
85
-            .'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n"
86
-            .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
80
+            '#### `' . $name . '`' . "\n\n"
81
+            .( $option->getDescription() ? preg_replace( '/\s*[\r\n]\s*/', "\n", $option->getDescription() ) . "\n\n" : '' )
82
+            .'* Accept value: ' . ( $option->acceptValue() ? 'yes' : 'no' ) . "\n"
83
+            .'* Is value required: ' . ( $option->isValueRequired() ? 'yes' : 'no' ) . "\n"
84
+            .'* Is multiple: ' . ( $option->isArray() ? 'yes' : 'no' ) . "\n"
85
+            .'* Is negatable: ' . ( $option->isNegatable() ? 'yes' : 'no' ) . "\n"
86
+            .'* Default: `' . str_replace( "\n", '', var_export( $option->getDefault(), true ) ) . '`'
87 87
         );
88 88
     }
89 89
 
90 90
     /**
91 91
      * {@inheritdoc}
92 92
      */
93
-    protected function describeInputDefinition(InputDefinition $definition, array $options = [])
93
+    protected function describeInputDefinition( InputDefinition $definition, array $options = [ ] )
94 94
     {
95
-        if ($showArguments = \count($definition->getArguments()) > 0) {
96
-            $this->write('### Arguments');
97
-            foreach ($definition->getArguments() as $argument) {
98
-                $this->write("\n\n");
99
-                if (null !== $describeInputArgument = $this->describeInputArgument($argument)) {
100
-                    $this->write($describeInputArgument);
95
+        if ( $showArguments = \count( $definition->getArguments() ) > 0 ) {
96
+            $this->write( '### Arguments' );
97
+            foreach ( $definition->getArguments() as $argument ) {
98
+                $this->write( "\n\n" );
99
+                if ( null !== $describeInputArgument = $this->describeInputArgument( $argument ) ) {
100
+                    $this->write( $describeInputArgument );
101 101
                 }
102 102
             }
103 103
         }
104 104
 
105
-        if (\count($definition->getOptions()) > 0) {
106
-            if ($showArguments) {
107
-                $this->write("\n\n");
105
+        if ( \count( $definition->getOptions() ) > 0 ) {
106
+            if ( $showArguments ) {
107
+                $this->write( "\n\n" );
108 108
             }
109 109
 
110
-            $this->write('### Options');
111
-            foreach ($definition->getOptions() as $option) {
112
-                $this->write("\n\n");
113
-                if (null !== $describeInputOption = $this->describeInputOption($option)) {
114
-                    $this->write($describeInputOption);
110
+            $this->write( '### Options' );
111
+            foreach ( $definition->getOptions() as $option ) {
112
+                $this->write( "\n\n" );
113
+                if ( null !== $describeInputOption = $this->describeInputOption( $option ) ) {
114
+                    $this->write( $describeInputOption );
115 115
                 }
116 116
             }
117 117
         }
@@ -120,82 +120,82 @@  discard block
 block discarded – undo
120 120
     /**
121 121
      * {@inheritdoc}
122 122
      */
123
-    protected function describeCommand(Command $command, array $options = [])
123
+    protected function describeCommand( Command $command, array $options = [ ] )
124 124
     {
125
-        if ($options['short'] ?? false) {
125
+        if ( $options[ 'short' ] ?? false ) {
126 126
             $this->write(
127
-                '`'.$command->getName()."`\n"
128
-                .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
129
-                .($command->getDescription() ? $command->getDescription()."\n\n" : '')
130
-                .'### Usage'."\n\n"
131
-                .array_reduce($command->getAliases(), function ($carry, $usage) {
132
-                    return $carry.'* `'.$usage.'`'."\n";
127
+                '`' . $command->getName() . "`\n"
128
+                .str_repeat( '-', Helper::width( $command->getName() ) + 2 ) . "\n\n"
129
+                .( $command->getDescription() ? $command->getDescription() . "\n\n" : '' )
130
+                .'### Usage' . "\n\n"
131
+                .array_reduce( $command->getAliases(), function( $carry, $usage ) {
132
+                    return $carry . '* `' . $usage . '`' . "\n";
133 133
                 })
134 134
             );
135 135
 
136 136
             return;
137 137
         }
138 138
 
139
-        $command->mergeApplicationDefinition(false);
139
+        $command->mergeApplicationDefinition( false );
140 140
 
141 141
         $this->write(
142
-            '`'.$command->getName()."`\n"
143
-            .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
144
-            .($command->getDescription() ? $command->getDescription()."\n\n" : '')
145
-            .'### Usage'."\n\n"
146
-            .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
147
-                return $carry.'* `'.$usage.'`'."\n";
142
+            '`' . $command->getName() . "`\n"
143
+            .str_repeat( '-', Helper::width( $command->getName() ) + 2 ) . "\n\n"
144
+            .( $command->getDescription() ? $command->getDescription() . "\n\n" : '' )
145
+            .'### Usage' . "\n\n"
146
+            .array_reduce( array_merge( [ $command->getSynopsis() ], $command->getAliases(), $command->getUsages() ), function( $carry, $usage ) {
147
+                return $carry . '* `' . $usage . '`' . "\n";
148 148
             })
149 149
         );
150 150
 
151
-        if ($help = $command->getProcessedHelp()) {
152
-            $this->write("\n");
153
-            $this->write($help);
151
+        if ( $help = $command->getProcessedHelp() ) {
152
+            $this->write( "\n" );
153
+            $this->write( $help );
154 154
         }
155 155
 
156 156
         $definition = $command->getDefinition();
157
-        if ($definition->getOptions() || $definition->getArguments()) {
158
-            $this->write("\n\n");
159
-            $this->describeInputDefinition($definition);
157
+        if ( $definition->getOptions() || $definition->getArguments() ) {
158
+            $this->write( "\n\n" );
159
+            $this->describeInputDefinition( $definition );
160 160
         }
161 161
     }
162 162
 
163 163
     /**
164 164
      * {@inheritdoc}
165 165
      */
166
-    protected function describeApplication(Application $application, array $options = [])
166
+    protected function describeApplication( Application $application, array $options = [ ] )
167 167
     {
168
-        $describedNamespace = $options['namespace'] ?? null;
169
-        $description = new ApplicationDescription($application, $describedNamespace);
170
-        $title = $this->getApplicationTitle($application);
168
+        $describedNamespace = $options[ 'namespace' ] ?? null;
169
+        $description = new ApplicationDescription( $application, $describedNamespace );
170
+        $title = $this->getApplicationTitle( $application );
171 171
 
172
-        $this->write($title."\n".str_repeat('=', Helper::width($title)));
172
+        $this->write( $title . "\n" . str_repeat( '=', Helper::width( $title ) ) );
173 173
 
174
-        foreach ($description->getNamespaces() as $namespace) {
175
-            if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
176
-                $this->write("\n\n");
177
-                $this->write('**'.$namespace['id'].':**');
174
+        foreach ( $description->getNamespaces() as $namespace ) {
175
+            if ( ApplicationDescription::GLOBAL_NAMESPACE !== $namespace[ 'id' ] ) {
176
+                $this->write( "\n\n" );
177
+                $this->write( '**' . $namespace[ 'id' ] . ':**' );
178 178
             }
179 179
 
180
-            $this->write("\n\n");
181
-            $this->write(implode("\n", array_map(function ($commandName) use ($description) {
182
-                return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName()));
183
-            }, $namespace['commands'])));
180
+            $this->write( "\n\n" );
181
+            $this->write( implode( "\n", array_map( function( $commandName ) use ( $description ) {
182
+                return sprintf( '* [`%s`](#%s)', $commandName, str_replace( ':', '', $description->getCommand( $commandName )->getName() ) );
183
+            }, $namespace[ 'commands' ] ) ) );
184 184
         }
185 185
 
186
-        foreach ($description->getCommands() as $command) {
187
-            $this->write("\n\n");
188
-            if (null !== $describeCommand = $this->describeCommand($command, $options)) {
189
-                $this->write($describeCommand);
186
+        foreach ( $description->getCommands() as $command ) {
187
+            $this->write( "\n\n" );
188
+            if ( null !== $describeCommand = $this->describeCommand( $command, $options ) ) {
189
+                $this->write( $describeCommand );
190 190
             }
191 191
         }
192 192
     }
193 193
 
194
-    private function getApplicationTitle(Application $application): string
194
+    private function getApplicationTitle( Application $application ): string
195 195
     {
196
-        if ('UNKNOWN' !== $application->getName()) {
197
-            if ('UNKNOWN' !== $application->getVersion()) {
198
-                return sprintf('%s %s', $application->getName(), $application->getVersion());
196
+        if ( 'UNKNOWN' !== $application->getName() ) {
197
+            if ( 'UNKNOWN' !== $application->getVersion() ) {
198
+                return sprintf( '%s %s', $application->getName(), $application->getVersion() );
199 199
             }
200 200
 
201 201
             return $application->getName();
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,13 +26,11 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @internal
28 28
  */
29
-class MarkdownDescriptor extends Descriptor
30
-{
29
+class MarkdownDescriptor extends Descriptor {
31 30
     /**
32 31
      * {@inheritdoc}
33 32
      */
34
-    public function describe(OutputInterface $output, object $object, array $options = [])
35
-    {
33
+    public function describe(OutputInterface $output, object $object, array $options = []) {
36 34
         $decorated = $output->isDecorated();
37 35
         $output->setDecorated(false);
38 36
 
@@ -44,16 +42,14 @@  discard block
 block discarded – undo
44 42
     /**
45 43
      * {@inheritdoc}
46 44
      */
47
-    protected function write(string $content, bool $decorated = true)
48
-    {
45
+    protected function write(string $content, bool $decorated = true) {
49 46
         parent::write($content, $decorated);
50 47
     }
51 48
 
52 49
     /**
53 50
      * {@inheritdoc}
54 51
      */
55
-    protected function describeInputArgument(InputArgument $argument, array $options = [])
56
-    {
52
+    protected function describeInputArgument(InputArgument $argument, array $options = []) {
57 53
         $this->write(
58 54
             '#### `'.($argument->getName() ?: '<none>')."`\n\n"
59 55
             .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '')
@@ -66,8 +62,7 @@  discard block
 block discarded – undo
66 62
     /**
67 63
      * {@inheritdoc}
68 64
      */
69
-    protected function describeInputOption(InputOption $option, array $options = [])
70
-    {
65
+    protected function describeInputOption(InputOption $option, array $options = []) {
71 66
         $name = '--'.$option->getName();
72 67
         if ($option->isNegatable()) {
73 68
             $name .= '|--no-'.$option->getName();
@@ -90,8 +85,7 @@  discard block
 block discarded – undo
90 85
     /**
91 86
      * {@inheritdoc}
92 87
      */
93
-    protected function describeInputDefinition(InputDefinition $definition, array $options = [])
94
-    {
88
+    protected function describeInputDefinition(InputDefinition $definition, array $options = []) {
95 89
         if ($showArguments = \count($definition->getArguments()) > 0) {
96 90
             $this->write('### Arguments');
97 91
             foreach ($definition->getArguments() as $argument) {
@@ -120,8 +114,7 @@  discard block
 block discarded – undo
120 114
     /**
121 115
      * {@inheritdoc}
122 116
      */
123
-    protected function describeCommand(Command $command, array $options = [])
124
-    {
117
+    protected function describeCommand(Command $command, array $options = []) {
125 118
         if ($options['short'] ?? false) {
126 119
             $this->write(
127 120
                 '`'.$command->getName()."`\n"
@@ -163,8 +156,7 @@  discard block
 block discarded – undo
163 156
     /**
164 157
      * {@inheritdoc}
165 158
      */
166
-    protected function describeApplication(Application $application, array $options = [])
167
-    {
159
+    protected function describeApplication(Application $application, array $options = []) {
168 160
         $describedNamespace = $options['namespace'] ?? null;
169 161
         $description = new ApplicationDescription($application, $describedNamespace);
170 162
         $title = $this->getApplicationTitle($application);
Please login to merge, or discard this patch.
vendor/symfony/console/Descriptor/Descriptor.php 3 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -26,69 +26,69 @@
 block discarded – undo
26 26
  */
27 27
 abstract class Descriptor implements DescriptorInterface
28 28
 {
29
-    /**
30
-     * @var OutputInterface
31
-     */
32
-    protected $output;
29
+	/**
30
+	 * @var OutputInterface
31
+	 */
32
+	protected $output;
33 33
 
34
-    /**
35
-     * {@inheritdoc}
36
-     */
37
-    public function describe(OutputInterface $output, object $object, array $options = [])
38
-    {
39
-        $this->output = $output;
34
+	/**
35
+	 * {@inheritdoc}
36
+	 */
37
+	public function describe(OutputInterface $output, object $object, array $options = [])
38
+	{
39
+		$this->output = $output;
40 40
 
41
-        switch (true) {
42
-            case $object instanceof InputArgument:
43
-                $this->describeInputArgument($object, $options);
44
-                break;
45
-            case $object instanceof InputOption:
46
-                $this->describeInputOption($object, $options);
47
-                break;
48
-            case $object instanceof InputDefinition:
49
-                $this->describeInputDefinition($object, $options);
50
-                break;
51
-            case $object instanceof Command:
52
-                $this->describeCommand($object, $options);
53
-                break;
54
-            case $object instanceof Application:
55
-                $this->describeApplication($object, $options);
56
-                break;
57
-            default:
58
-                throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object)));
59
-        }
60
-    }
41
+		switch (true) {
42
+			case $object instanceof InputArgument:
43
+				$this->describeInputArgument($object, $options);
44
+				break;
45
+			case $object instanceof InputOption:
46
+				$this->describeInputOption($object, $options);
47
+				break;
48
+			case $object instanceof InputDefinition:
49
+				$this->describeInputDefinition($object, $options);
50
+				break;
51
+			case $object instanceof Command:
52
+				$this->describeCommand($object, $options);
53
+				break;
54
+			case $object instanceof Application:
55
+				$this->describeApplication($object, $options);
56
+				break;
57
+			default:
58
+				throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object)));
59
+		}
60
+	}
61 61
 
62
-    /**
63
-     * Writes content to output.
64
-     */
65
-    protected function write(string $content, bool $decorated = false)
66
-    {
67
-        $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
68
-    }
62
+	/**
63
+	 * Writes content to output.
64
+	 */
65
+	protected function write(string $content, bool $decorated = false)
66
+	{
67
+		$this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
68
+	}
69 69
 
70
-    /**
71
-     * Describes an InputArgument instance.
72
-     */
73
-    abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
70
+	/**
71
+	 * Describes an InputArgument instance.
72
+	 */
73
+	abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
74 74
 
75
-    /**
76
-     * Describes an InputOption instance.
77
-     */
78
-    abstract protected function describeInputOption(InputOption $option, array $options = []);
75
+	/**
76
+	 * Describes an InputOption instance.
77
+	 */
78
+	abstract protected function describeInputOption(InputOption $option, array $options = []);
79 79
 
80
-    /**
81
-     * Describes an InputDefinition instance.
82
-     */
83
-    abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
80
+	/**
81
+	 * Describes an InputDefinition instance.
82
+	 */
83
+	abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
84 84
 
85
-    /**
86
-     * Describes a Command instance.
87
-     */
88
-    abstract protected function describeCommand(Command $command, array $options = []);
85
+	/**
86
+	 * Describes a Command instance.
87
+	 */
88
+	abstract protected function describeCommand(Command $command, array $options = []);
89 89
 
90
-    /**
91
-     * Describes an Application instance.
92
-     */
93
-    abstract protected function describeApplication(Application $application, array $options = []);
90
+	/**
91
+	 * Describes an Application instance.
92
+	 */
93
+	abstract protected function describeApplication(Application $application, array $options = []);
94 94
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -34,61 +34,61 @@
 block discarded – undo
34 34
     /**
35 35
      * {@inheritdoc}
36 36
      */
37
-    public function describe(OutputInterface $output, object $object, array $options = [])
37
+    public function describe( OutputInterface $output, object $object, array $options = [ ] )
38 38
     {
39 39
         $this->output = $output;
40 40
 
41
-        switch (true) {
41
+        switch ( true ) {
42 42
             case $object instanceof InputArgument:
43
-                $this->describeInputArgument($object, $options);
43
+                $this->describeInputArgument( $object, $options );
44 44
                 break;
45 45
             case $object instanceof InputOption:
46
-                $this->describeInputOption($object, $options);
46
+                $this->describeInputOption( $object, $options );
47 47
                 break;
48 48
             case $object instanceof InputDefinition:
49
-                $this->describeInputDefinition($object, $options);
49
+                $this->describeInputDefinition( $object, $options );
50 50
                 break;
51 51
             case $object instanceof Command:
52
-                $this->describeCommand($object, $options);
52
+                $this->describeCommand( $object, $options );
53 53
                 break;
54 54
             case $object instanceof Application:
55
-                $this->describeApplication($object, $options);
55
+                $this->describeApplication( $object, $options );
56 56
                 break;
57 57
             default:
58
-                throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object)));
58
+                throw new InvalidArgumentException( sprintf( 'Object of type "%s" is not describable.', get_debug_type( $object ) ) );
59 59
         }
60 60
     }
61 61
 
62 62
     /**
63 63
      * Writes content to output.
64 64
      */
65
-    protected function write(string $content, bool $decorated = false)
65
+    protected function write( string $content, bool $decorated = false )
66 66
     {
67
-        $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
67
+        $this->output->write( $content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW );
68 68
     }
69 69
 
70 70
     /**
71 71
      * Describes an InputArgument instance.
72 72
      */
73
-    abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
73
+    abstract protected function describeInputArgument( InputArgument $argument, array $options = [ ] );
74 74
 
75 75
     /**
76 76
      * Describes an InputOption instance.
77 77
      */
78
-    abstract protected function describeInputOption(InputOption $option, array $options = []);
78
+    abstract protected function describeInputOption( InputOption $option, array $options = [ ] );
79 79
 
80 80
     /**
81 81
      * Describes an InputDefinition instance.
82 82
      */
83
-    abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
83
+    abstract protected function describeInputDefinition( InputDefinition $definition, array $options = [ ] );
84 84
 
85 85
     /**
86 86
      * Describes a Command instance.
87 87
      */
88
-    abstract protected function describeCommand(Command $command, array $options = []);
88
+    abstract protected function describeCommand( Command $command, array $options = [ ] );
89 89
 
90 90
     /**
91 91
      * Describes an Application instance.
92 92
      */
93
-    abstract protected function describeApplication(Application $application, array $options = []);
93
+    abstract protected function describeApplication( Application $application, array $options = [ ] );
94 94
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @internal
26 26
  */
27
-abstract class Descriptor implements DescriptorInterface
28
-{
27
+abstract class Descriptor implements DescriptorInterface {
29 28
     /**
30 29
      * @var OutputInterface
31 30
      */
@@ -34,8 +33,7 @@  discard block
 block discarded – undo
34 33
     /**
35 34
      * {@inheritdoc}
36 35
      */
37
-    public function describe(OutputInterface $output, object $object, array $options = [])
38
-    {
36
+    public function describe(OutputInterface $output, object $object, array $options = []) {
39 37
         $this->output = $output;
40 38
 
41 39
         switch (true) {
@@ -62,8 +60,7 @@  discard block
 block discarded – undo
62 60
     /**
63 61
      * Writes content to output.
64 62
      */
65
-    protected function write(string $content, bool $decorated = false)
66
-    {
63
+    protected function write(string $content, bool $decorated = false) {
67 64
         $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
68 65
     }
69 66
 
Please login to merge, or discard this patch.