Completed
Push — develop ( d12426...aff1bc )
by Zack
18:32
created
vendor/symfony/console/Command/ListCommand.php 4 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -24,21 +24,21 @@  discard block
 block discarded – undo
24 24
  */
25 25
 class ListCommand extends Command
26 26
 {
27
-    /**
28
-     * {@inheritdoc}
29
-     */
30
-    protected function configure()
31
-    {
32
-        $this
33
-            ->setName('list')
34
-            ->setDefinition([
35
-                new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
36
-                new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
37
-                new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
38
-                new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments'),
39
-            ])
40
-            ->setDescription('List commands')
41
-            ->setHelp(<<<'EOF'
27
+	/**
28
+	 * {@inheritdoc}
29
+	 */
30
+	protected function configure()
31
+	{
32
+		$this
33
+			->setName('list')
34
+			->setDefinition([
35
+				new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
36
+				new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
37
+				new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
38
+				new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments'),
39
+			])
40
+			->setDescription('List commands')
41
+			->setHelp(<<<'EOF'
42 42
 The <info>%command.name%</info> command lists all commands:
43 43
 
44 44
   <info>%command.full_name%</info>
@@ -55,23 +55,23 @@  discard block
 block discarded – undo
55 55
 
56 56
   <info>%command.full_name% --raw</info>
57 57
 EOF
58
-            )
59
-        ;
60
-    }
58
+			)
59
+		;
60
+	}
61 61
 
62
-    /**
63
-     * {@inheritdoc}
64
-     */
65
-    protected function execute(InputInterface $input, OutputInterface $output)
66
-    {
67
-        $helper = new DescriptorHelper();
68
-        $helper->describe($output, $this->getApplication(), [
69
-            'format' => $input->getOption('format'),
70
-            'raw_text' => $input->getOption('raw'),
71
-            'namespace' => $input->getArgument('namespace'),
72
-            'short' => $input->getOption('short'),
73
-        ]);
62
+	/**
63
+	 * {@inheritdoc}
64
+	 */
65
+	protected function execute(InputInterface $input, OutputInterface $output)
66
+	{
67
+		$helper = new DescriptorHelper();
68
+		$helper->describe($output, $this->getApplication(), [
69
+			'format' => $input->getOption('format'),
70
+			'raw_text' => $input->getOption('raw'),
71
+			'namespace' => $input->getArgument('namespace'),
72
+			'short' => $input->getOption('short'),
73
+		]);
74 74
 
75
-        return 0;
76
-    }
75
+		return 0;
76
+	}
77 77
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
     protected function configure()
31 31
     {
32 32
         $this
33
-            ->setName('list')
34
-            ->setDefinition([
35
-                new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
36
-                new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
37
-                new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
38
-                new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments'),
39
-            ])
40
-            ->setDescription('List commands')
41
-            ->setHelp(<<<'EOF'
33
+            ->setName( 'list' )
34
+            ->setDefinition( [
35
+                new InputArgument( 'namespace', InputArgument::OPTIONAL, 'The namespace name' ),
36
+                new InputOption( 'raw', null, InputOption::VALUE_NONE, 'To output raw command list' ),
37
+                new InputOption( 'format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt' ),
38
+                new InputOption( 'short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments' ),
39
+            ] )
40
+            ->setDescription( 'List commands' )
41
+            ->setHelp( <<<'EOF'
42 42
 The <info>%command.name%</info> command lists all commands:
43 43
 
44 44
   <info>%command.full_name%</info>
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * {@inheritdoc}
64 64
      */
65
-    protected function execute(InputInterface $input, OutputInterface $output)
65
+    protected function execute( InputInterface $input, OutputInterface $output )
66 66
     {
67 67
         $helper = new DescriptorHelper();
68
-        $helper->describe($output, $this->getApplication(), [
69
-            'format' => $input->getOption('format'),
70
-            'raw_text' => $input->getOption('raw'),
71
-            'namespace' => $input->getArgument('namespace'),
72
-            'short' => $input->getOption('short'),
73
-        ]);
68
+        $helper->describe( $output, $this->getApplication(), [
69
+            'format' => $input->getOption( 'format' ),
70
+            'raw_text' => $input->getOption( 'raw' ),
71
+            'namespace' => $input->getArgument( 'namespace' ),
72
+            'short' => $input->getOption( 'short' ),
73
+        ] );
74 74
 
75 75
         return 0;
76 76
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,13 +22,11 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @author Fabien Potencier <[email protected]>
24 24
  */
25
-class ListCommand extends Command
26
-{
25
+class ListCommand extends Command {
27 26
     /**
28 27
      * {@inheritdoc}
29 28
      */
30
-    protected function configure()
31
-    {
29
+    protected function configure() {
32 30
         $this
33 31
             ->setName('list')
34 32
             ->setDefinition([
@@ -62,8 +60,7 @@  discard block
 block discarded – undo
62 60
     /**
63 61
      * {@inheritdoc}
64 62
      */
65
-    protected function execute(InputInterface $input, OutputInterface $output)
66
-    {
63
+    protected function execute(InputInterface $input, OutputInterface $output) {
67 64
         $helper = new DescriptorHelper();
68 65
         $helper->describe($output, $this->getApplication(), [
69 66
             'format' => $input->getOption('format'),
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 It's also possible to get raw list of commands (useful for embedding command runner):
55 55
 
56 56
   <info>%command.full_name% --raw</info>
57
-EOF
57
+eof
58 58
             )
59 59
         ;
60 60
     }
Please login to merge, or discard this patch.
vendor/symfony/console/Command/LazyCommand.php 3 patches
Indentation   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -22,190 +22,190 @@
 block discarded – undo
22 22
  */
23 23
 final class LazyCommand extends Command
24 24
 {
25
-    private $command;
26
-    private $isEnabled;
27
-
28
-    public function __construct(string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = true)
29
-    {
30
-        $this->setName($name)
31
-            ->setAliases($aliases)
32
-            ->setHidden($isHidden)
33
-            ->setDescription($description);
34
-
35
-        $this->command = $commandFactory;
36
-        $this->isEnabled = $isEnabled;
37
-    }
38
-
39
-    public function ignoreValidationErrors(): void
40
-    {
41
-        $this->getCommand()->ignoreValidationErrors();
42
-    }
43
-
44
-    public function setApplication(Application $application = null): void
45
-    {
46
-        if ($this->command instanceof parent) {
47
-            $this->command->setApplication($application);
48
-        }
49
-
50
-        parent::setApplication($application);
51
-    }
52
-
53
-    public function setHelperSet(HelperSet $helperSet): void
54
-    {
55
-        if ($this->command instanceof parent) {
56
-            $this->command->setHelperSet($helperSet);
57
-        }
58
-
59
-        parent::setHelperSet($helperSet);
60
-    }
61
-
62
-    public function isEnabled(): bool
63
-    {
64
-        return $this->isEnabled ?? $this->getCommand()->isEnabled();
65
-    }
66
-
67
-    public function run(InputInterface $input, OutputInterface $output): int
68
-    {
69
-        return $this->getCommand()->run($input, $output);
70
-    }
71
-
72
-    /**
73
-     * @return $this
74
-     */
75
-    public function setCode(callable $code): self
76
-    {
77
-        $this->getCommand()->setCode($code);
78
-
79
-        return $this;
80
-    }
81
-
82
-    /**
83
-     * @internal
84
-     */
85
-    public function mergeApplicationDefinition(bool $mergeArgs = true): void
86
-    {
87
-        $this->getCommand()->mergeApplicationDefinition($mergeArgs);
88
-    }
89
-
90
-    /**
91
-     * @return $this
92
-     */
93
-    public function setDefinition($definition): self
94
-    {
95
-        $this->getCommand()->setDefinition($definition);
96
-
97
-        return $this;
98
-    }
99
-
100
-    public function getDefinition(): InputDefinition
101
-    {
102
-        return $this->getCommand()->getDefinition();
103
-    }
104
-
105
-    public function getNativeDefinition(): InputDefinition
106
-    {
107
-        return $this->getCommand()->getNativeDefinition();
108
-    }
109
-
110
-    /**
111
-     * @return $this
112
-     */
113
-    public function addArgument(string $name, int $mode = null, string $description = '', $default = null): self
114
-    {
115
-        $this->getCommand()->addArgument($name, $mode, $description, $default);
116
-
117
-        return $this;
118
-    }
119
-
120
-    /**
121
-     * @return $this
122
-     */
123
-    public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null): self
124
-    {
125
-        $this->getCommand()->addOption($name, $shortcut, $mode, $description, $default);
126
-
127
-        return $this;
128
-    }
129
-
130
-    /**
131
-     * @return $this
132
-     */
133
-    public function setProcessTitle(string $title): self
134
-    {
135
-        $this->getCommand()->setProcessTitle($title);
136
-
137
-        return $this;
138
-    }
139
-
140
-    /**
141
-     * @return $this
142
-     */
143
-    public function setHelp(string $help): self
144
-    {
145
-        $this->getCommand()->setHelp($help);
146
-
147
-        return $this;
148
-    }
149
-
150
-    public function getHelp(): string
151
-    {
152
-        return $this->getCommand()->getHelp();
153
-    }
154
-
155
-    public function getProcessedHelp(): string
156
-    {
157
-        return $this->getCommand()->getProcessedHelp();
158
-    }
159
-
160
-    public function getSynopsis(bool $short = false): string
161
-    {
162
-        return $this->getCommand()->getSynopsis($short);
163
-    }
164
-
165
-    /**
166
-     * @return $this
167
-     */
168
-    public function addUsage(string $usage): self
169
-    {
170
-        $this->getCommand()->addUsage($usage);
171
-
172
-        return $this;
173
-    }
174
-
175
-    public function getUsages(): array
176
-    {
177
-        return $this->getCommand()->getUsages();
178
-    }
179
-
180
-    /**
181
-     * @return mixed
182
-     */
183
-    public function getHelper(string $name)
184
-    {
185
-        return $this->getCommand()->getHelper($name);
186
-    }
187
-
188
-    public function getCommand(): parent
189
-    {
190
-        if (!$this->command instanceof \Closure) {
191
-            return $this->command;
192
-        }
193
-
194
-        $command = $this->command = ($this->command)();
195
-        $command->setApplication($this->getApplication());
196
-
197
-        if (null !== $this->getHelperSet()) {
198
-            $command->setHelperSet($this->getHelperSet());
199
-        }
200
-
201
-        $command->setName($this->getName())
202
-            ->setAliases($this->getAliases())
203
-            ->setHidden($this->isHidden())
204
-            ->setDescription($this->getDescription());
205
-
206
-        // Will throw if the command is not correctly initialized.
207
-        $command->getDefinition();
208
-
209
-        return $command;
210
-    }
25
+	private $command;
26
+	private $isEnabled;
27
+
28
+	public function __construct(string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = true)
29
+	{
30
+		$this->setName($name)
31
+			->setAliases($aliases)
32
+			->setHidden($isHidden)
33
+			->setDescription($description);
34
+
35
+		$this->command = $commandFactory;
36
+		$this->isEnabled = $isEnabled;
37
+	}
38
+
39
+	public function ignoreValidationErrors(): void
40
+	{
41
+		$this->getCommand()->ignoreValidationErrors();
42
+	}
43
+
44
+	public function setApplication(Application $application = null): void
45
+	{
46
+		if ($this->command instanceof parent) {
47
+			$this->command->setApplication($application);
48
+		}
49
+
50
+		parent::setApplication($application);
51
+	}
52
+
53
+	public function setHelperSet(HelperSet $helperSet): void
54
+	{
55
+		if ($this->command instanceof parent) {
56
+			$this->command->setHelperSet($helperSet);
57
+		}
58
+
59
+		parent::setHelperSet($helperSet);
60
+	}
61
+
62
+	public function isEnabled(): bool
63
+	{
64
+		return $this->isEnabled ?? $this->getCommand()->isEnabled();
65
+	}
66
+
67
+	public function run(InputInterface $input, OutputInterface $output): int
68
+	{
69
+		return $this->getCommand()->run($input, $output);
70
+	}
71
+
72
+	/**
73
+	 * @return $this
74
+	 */
75
+	public function setCode(callable $code): self
76
+	{
77
+		$this->getCommand()->setCode($code);
78
+
79
+		return $this;
80
+	}
81
+
82
+	/**
83
+	 * @internal
84
+	 */
85
+	public function mergeApplicationDefinition(bool $mergeArgs = true): void
86
+	{
87
+		$this->getCommand()->mergeApplicationDefinition($mergeArgs);
88
+	}
89
+
90
+	/**
91
+	 * @return $this
92
+	 */
93
+	public function setDefinition($definition): self
94
+	{
95
+		$this->getCommand()->setDefinition($definition);
96
+
97
+		return $this;
98
+	}
99
+
100
+	public function getDefinition(): InputDefinition
101
+	{
102
+		return $this->getCommand()->getDefinition();
103
+	}
104
+
105
+	public function getNativeDefinition(): InputDefinition
106
+	{
107
+		return $this->getCommand()->getNativeDefinition();
108
+	}
109
+
110
+	/**
111
+	 * @return $this
112
+	 */
113
+	public function addArgument(string $name, int $mode = null, string $description = '', $default = null): self
114
+	{
115
+		$this->getCommand()->addArgument($name, $mode, $description, $default);
116
+
117
+		return $this;
118
+	}
119
+
120
+	/**
121
+	 * @return $this
122
+	 */
123
+	public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null): self
124
+	{
125
+		$this->getCommand()->addOption($name, $shortcut, $mode, $description, $default);
126
+
127
+		return $this;
128
+	}
129
+
130
+	/**
131
+	 * @return $this
132
+	 */
133
+	public function setProcessTitle(string $title): self
134
+	{
135
+		$this->getCommand()->setProcessTitle($title);
136
+
137
+		return $this;
138
+	}
139
+
140
+	/**
141
+	 * @return $this
142
+	 */
143
+	public function setHelp(string $help): self
144
+	{
145
+		$this->getCommand()->setHelp($help);
146
+
147
+		return $this;
148
+	}
149
+
150
+	public function getHelp(): string
151
+	{
152
+		return $this->getCommand()->getHelp();
153
+	}
154
+
155
+	public function getProcessedHelp(): string
156
+	{
157
+		return $this->getCommand()->getProcessedHelp();
158
+	}
159
+
160
+	public function getSynopsis(bool $short = false): string
161
+	{
162
+		return $this->getCommand()->getSynopsis($short);
163
+	}
164
+
165
+	/**
166
+	 * @return $this
167
+	 */
168
+	public function addUsage(string $usage): self
169
+	{
170
+		$this->getCommand()->addUsage($usage);
171
+
172
+		return $this;
173
+	}
174
+
175
+	public function getUsages(): array
176
+	{
177
+		return $this->getCommand()->getUsages();
178
+	}
179
+
180
+	/**
181
+	 * @return mixed
182
+	 */
183
+	public function getHelper(string $name)
184
+	{
185
+		return $this->getCommand()->getHelper($name);
186
+	}
187
+
188
+	public function getCommand(): parent
189
+	{
190
+		if (!$this->command instanceof \Closure) {
191
+			return $this->command;
192
+		}
193
+
194
+		$command = $this->command = ($this->command)();
195
+		$command->setApplication($this->getApplication());
196
+
197
+		if (null !== $this->getHelperSet()) {
198
+			$command->setHelperSet($this->getHelperSet());
199
+		}
200
+
201
+		$command->setName($this->getName())
202
+			->setAliases($this->getAliases())
203
+			->setHidden($this->isHidden())
204
+			->setDescription($this->getDescription());
205
+
206
+		// Will throw if the command is not correctly initialized.
207
+		$command->getDefinition();
208
+
209
+		return $command;
210
+	}
211 211
 }
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
     private $command;
26 26
     private $isEnabled;
27 27
 
28
-    public function __construct(string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = true)
28
+    public function __construct( string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = true )
29 29
     {
30
-        $this->setName($name)
31
-            ->setAliases($aliases)
32
-            ->setHidden($isHidden)
33
-            ->setDescription($description);
30
+        $this->setName( $name )
31
+            ->setAliases( $aliases )
32
+            ->setHidden( $isHidden )
33
+            ->setDescription( $description );
34 34
 
35 35
         $this->command = $commandFactory;
36 36
         $this->isEnabled = $isEnabled;
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
         $this->getCommand()->ignoreValidationErrors();
42 42
     }
43 43
 
44
-    public function setApplication(Application $application = null): void
44
+    public function setApplication( Application $application = null ): void
45 45
     {
46
-        if ($this->command instanceof parent) {
47
-            $this->command->setApplication($application);
46
+        if ( $this->command instanceof parent ) {
47
+            $this->command->setApplication( $application );
48 48
         }
49 49
 
50
-        parent::setApplication($application);
50
+        parent::setApplication( $application );
51 51
     }
52 52
 
53
-    public function setHelperSet(HelperSet $helperSet): void
53
+    public function setHelperSet( HelperSet $helperSet ): void
54 54
     {
55
-        if ($this->command instanceof parent) {
56
-            $this->command->setHelperSet($helperSet);
55
+        if ( $this->command instanceof parent ) {
56
+            $this->command->setHelperSet( $helperSet );
57 57
         }
58 58
 
59
-        parent::setHelperSet($helperSet);
59
+        parent::setHelperSet( $helperSet );
60 60
     }
61 61
 
62 62
     public function isEnabled(): bool
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
         return $this->isEnabled ?? $this->getCommand()->isEnabled();
65 65
     }
66 66
 
67
-    public function run(InputInterface $input, OutputInterface $output): int
67
+    public function run( InputInterface $input, OutputInterface $output ): int
68 68
     {
69
-        return $this->getCommand()->run($input, $output);
69
+        return $this->getCommand()->run( $input, $output );
70 70
     }
71 71
 
72 72
     /**
73 73
      * @return $this
74 74
      */
75
-    public function setCode(callable $code): self
75
+    public function setCode( callable $code ): self
76 76
     {
77
-        $this->getCommand()->setCode($code);
77
+        $this->getCommand()->setCode( $code );
78 78
 
79 79
         return $this;
80 80
     }
@@ -82,17 +82,17 @@  discard block
 block discarded – undo
82 82
     /**
83 83
      * @internal
84 84
      */
85
-    public function mergeApplicationDefinition(bool $mergeArgs = true): void
85
+    public function mergeApplicationDefinition( bool $mergeArgs = true ): void
86 86
     {
87
-        $this->getCommand()->mergeApplicationDefinition($mergeArgs);
87
+        $this->getCommand()->mergeApplicationDefinition( $mergeArgs );
88 88
     }
89 89
 
90 90
     /**
91 91
      * @return $this
92 92
      */
93
-    public function setDefinition($definition): self
93
+    public function setDefinition( $definition ): self
94 94
     {
95
-        $this->getCommand()->setDefinition($definition);
95
+        $this->getCommand()->setDefinition( $definition );
96 96
 
97 97
         return $this;
98 98
     }
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
     /**
111 111
      * @return $this
112 112
      */
113
-    public function addArgument(string $name, int $mode = null, string $description = '', $default = null): self
113
+    public function addArgument( string $name, int $mode = null, string $description = '', $default = null ): self
114 114
     {
115
-        $this->getCommand()->addArgument($name, $mode, $description, $default);
115
+        $this->getCommand()->addArgument( $name, $mode, $description, $default );
116 116
 
117 117
         return $this;
118 118
     }
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
     /**
121 121
      * @return $this
122 122
      */
123
-    public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null): self
123
+    public function addOption( string $name, $shortcut = null, int $mode = null, string $description = '', $default = null ): self
124 124
     {
125
-        $this->getCommand()->addOption($name, $shortcut, $mode, $description, $default);
125
+        $this->getCommand()->addOption( $name, $shortcut, $mode, $description, $default );
126 126
 
127 127
         return $this;
128 128
     }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
     /**
131 131
      * @return $this
132 132
      */
133
-    public function setProcessTitle(string $title): self
133
+    public function setProcessTitle( string $title ): self
134 134
     {
135
-        $this->getCommand()->setProcessTitle($title);
135
+        $this->getCommand()->setProcessTitle( $title );
136 136
 
137 137
         return $this;
138 138
     }
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
     /**
141 141
      * @return $this
142 142
      */
143
-    public function setHelp(string $help): self
143
+    public function setHelp( string $help ): self
144 144
     {
145
-        $this->getCommand()->setHelp($help);
145
+        $this->getCommand()->setHelp( $help );
146 146
 
147 147
         return $this;
148 148
     }
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
         return $this->getCommand()->getProcessedHelp();
158 158
     }
159 159
 
160
-    public function getSynopsis(bool $short = false): string
160
+    public function getSynopsis( bool $short = false ): string
161 161
     {
162
-        return $this->getCommand()->getSynopsis($short);
162
+        return $this->getCommand()->getSynopsis( $short );
163 163
     }
164 164
 
165 165
     /**
166 166
      * @return $this
167 167
      */
168
-    public function addUsage(string $usage): self
168
+    public function addUsage( string $usage ): self
169 169
     {
170
-        $this->getCommand()->addUsage($usage);
170
+        $this->getCommand()->addUsage( $usage );
171 171
 
172 172
         return $this;
173 173
     }
@@ -180,28 +180,28 @@  discard block
 block discarded – undo
180 180
     /**
181 181
      * @return mixed
182 182
      */
183
-    public function getHelper(string $name)
183
+    public function getHelper( string $name )
184 184
     {
185
-        return $this->getCommand()->getHelper($name);
185
+        return $this->getCommand()->getHelper( $name );
186 186
     }
187 187
 
188 188
     public function getCommand(): parent
189 189
     {
190
-        if (!$this->command instanceof \Closure) {
190
+        if ( ! $this->command instanceof \Closure ) {
191 191
             return $this->command;
192 192
         }
193 193
 
194
-        $command = $this->command = ($this->command)();
195
-        $command->setApplication($this->getApplication());
194
+        $command = $this->command = ( $this->command )();
195
+        $command->setApplication( $this->getApplication() );
196 196
 
197
-        if (null !== $this->getHelperSet()) {
198
-            $command->setHelperSet($this->getHelperSet());
197
+        if ( null !== $this->getHelperSet() ) {
198
+            $command->setHelperSet( $this->getHelperSet() );
199 199
         }
200 200
 
201
-        $command->setName($this->getName())
202
-            ->setAliases($this->getAliases())
203
-            ->setHidden($this->isHidden())
204
-            ->setDescription($this->getDescription());
201
+        $command->setName( $this->getName() )
202
+            ->setAliases( $this->getAliases() )
203
+            ->setHidden( $this->isHidden() )
204
+            ->setDescription( $this->getDescription() );
205 205
 
206 206
         // Will throw if the command is not correctly initialized.
207 207
         $command->getDefinition();
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,13 +20,11 @@  discard block
 block discarded – undo
20 20
 /**
21 21
  * @author Nicolas Grekas <[email protected]>
22 22
  */
23
-final class LazyCommand extends Command
24
-{
23
+final class LazyCommand extends Command {
25 24
     private $command;
26 25
     private $isEnabled;
27 26
 
28
-    public function __construct(string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = true)
29
-    {
27
+    public function __construct(string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = true) {
30 28
         $this->setName($name)
31 29
             ->setAliases($aliases)
32 30
             ->setHidden($isHidden)
@@ -180,8 +178,7 @@  discard block
 block discarded – undo
180 178
     /**
181 179
      * @return mixed
182 180
      */
183
-    public function getHelper(string $name)
184
-    {
181
+    public function getHelper(string $name) {
185 182
         return $this->getCommand()->getHelper($name);
186 183
     }
187 184
 
Please login to merge, or discard this patch.
vendor/symfony/console/Command/LockableTrait.php 3 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -24,46 +24,46 @@
 block discarded – undo
24 24
  */
25 25
 trait LockableTrait
26 26
 {
27
-    /** @var Lock */
28
-    private $lock;
27
+	/** @var Lock */
28
+	private $lock;
29 29
 
30
-    /**
31
-     * Locks a command.
32
-     */
33
-    private function lock(string $name = null, bool $blocking = false): bool
34
-    {
35
-        if (!class_exists(SemaphoreStore::class)) {
36
-            throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
37
-        }
30
+	/**
31
+	 * Locks a command.
32
+	 */
33
+	private function lock(string $name = null, bool $blocking = false): bool
34
+	{
35
+		if (!class_exists(SemaphoreStore::class)) {
36
+			throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
37
+		}
38 38
 
39
-        if (null !== $this->lock) {
40
-            throw new LogicException('A lock is already in place.');
41
-        }
39
+		if (null !== $this->lock) {
40
+			throw new LogicException('A lock is already in place.');
41
+		}
42 42
 
43
-        if (SemaphoreStore::isSupported()) {
44
-            $store = new SemaphoreStore();
45
-        } else {
46
-            $store = new FlockStore();
47
-        }
43
+		if (SemaphoreStore::isSupported()) {
44
+			$store = new SemaphoreStore();
45
+		} else {
46
+			$store = new FlockStore();
47
+		}
48 48
 
49
-        $this->lock = (new LockFactory($store))->createLock($name ?: $this->getName());
50
-        if (!$this->lock->acquire($blocking)) {
51
-            $this->lock = null;
49
+		$this->lock = (new LockFactory($store))->createLock($name ?: $this->getName());
50
+		if (!$this->lock->acquire($blocking)) {
51
+			$this->lock = null;
52 52
 
53
-            return false;
54
-        }
53
+			return false;
54
+		}
55 55
 
56
-        return true;
57
-    }
56
+		return true;
57
+	}
58 58
 
59
-    /**
60
-     * Releases the command lock if there is one.
61
-     */
62
-    private function release()
63
-    {
64
-        if ($this->lock) {
65
-            $this->lock->release();
66
-            $this->lock = null;
67
-        }
68
-    }
59
+	/**
60
+	 * Releases the command lock if there is one.
61
+	 */
62
+	private function release()
63
+	{
64
+		if ($this->lock) {
65
+			$this->lock->release();
66
+			$this->lock = null;
67
+		}
68
+	}
69 69
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,24 +30,24 @@  discard block
 block discarded – undo
30 30
     /**
31 31
      * Locks a command.
32 32
      */
33
-    private function lock(string $name = null, bool $blocking = false): bool
33
+    private function lock( string $name = null, bool $blocking = false ): bool
34 34
     {
35
-        if (!class_exists(SemaphoreStore::class)) {
36
-            throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
35
+        if ( ! class_exists( SemaphoreStore::class ) ) {
36
+            throw new LogicException( 'To enable the locking feature you must install the symfony/lock component.' );
37 37
         }
38 38
 
39
-        if (null !== $this->lock) {
40
-            throw new LogicException('A lock is already in place.');
39
+        if ( null !== $this->lock ) {
40
+            throw new LogicException( 'A lock is already in place.' );
41 41
         }
42 42
 
43
-        if (SemaphoreStore::isSupported()) {
43
+        if ( SemaphoreStore::isSupported() ) {
44 44
             $store = new SemaphoreStore();
45 45
         } else {
46 46
             $store = new FlockStore();
47 47
         }
48 48
 
49
-        $this->lock = (new LockFactory($store))->createLock($name ?: $this->getName());
50
-        if (!$this->lock->acquire($blocking)) {
49
+        $this->lock = ( new LockFactory( $store ) )->createLock( $name ?: $this->getName() );
50
+        if ( ! $this->lock->acquire( $blocking ) ) {
51 51
             $this->lock = null;
52 52
 
53 53
             return false;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     private function release()
63 63
     {
64
-        if ($this->lock) {
64
+        if ( $this->lock ) {
65 65
             $this->lock->release();
66 66
             $this->lock = null;
67 67
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @author Geoffrey Brier <[email protected]>
24 24
  */
25
-trait LockableTrait
26
-{
25
+trait LockableTrait {
27 26
     /** @var Lock */
28 27
     private $lock;
29 28
 
@@ -59,8 +58,7 @@  discard block
 block discarded – undo
59 58
     /**
60 59
      * Releases the command lock if there is one.
61 60
      */
62
-    private function release()
63
-    {
61
+    private function release() {
64 62
         if ($this->lock) {
65 63
             $this->lock->release();
66 64
             $this->lock = null;
Please login to merge, or discard this patch.
vendor/symfony/console/Command/Command.php 3 patches
Indentation   +671 added lines, -671 removed lines patch added patch discarded remove patch
@@ -30,675 +30,675 @@
 block discarded – undo
30 30
  */
31 31
 class Command
32 32
 {
33
-    // see https://tldp.org/LDP/abs/html/exitcodes.html
34
-    public const SUCCESS = 0;
35
-    public const FAILURE = 1;
36
-    public const INVALID = 2;
37
-
38
-    /**
39
-     * @var string|null The default command name
40
-     */
41
-    protected static $defaultName;
42
-
43
-    /**
44
-     * @var string|null The default command description
45
-     */
46
-    protected static $defaultDescription;
47
-
48
-    private $application;
49
-    private $name;
50
-    private $processTitle;
51
-    private $aliases = [];
52
-    private $definition;
53
-    private $hidden = false;
54
-    private $help = '';
55
-    private $description = '';
56
-    private $fullDefinition;
57
-    private $ignoreValidationErrors = false;
58
-    private $code;
59
-    private $synopsis = [];
60
-    private $usages = [];
61
-    private $helperSet;
62
-
63
-    /**
64
-     * @return string|null The default command name or null when no default name is set
65
-     */
66
-    public static function getDefaultName()
67
-    {
68
-        $class = static::class;
69
-
70
-        if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
71
-            return $attribute[0]->newInstance()->name;
72
-        }
73
-
74
-        $r = new \ReflectionProperty($class, 'defaultName');
75
-
76
-        return $class === $r->class ? static::$defaultName : null;
77
-    }
78
-
79
-    /**
80
-     * @return string|null The default command description or null when no default description is set
81
-     */
82
-    public static function getDefaultDescription(): ?string
83
-    {
84
-        $class = static::class;
85
-
86
-        if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
87
-            return $attribute[0]->newInstance()->description;
88
-        }
89
-
90
-        $r = new \ReflectionProperty($class, 'defaultDescription');
91
-
92
-        return $class === $r->class ? static::$defaultDescription : null;
93
-    }
94
-
95
-    /**
96
-     * @param string|null $name The name of the command; passing null means it must be set in configure()
97
-     *
98
-     * @throws LogicException When the command name is empty
99
-     */
100
-    public function __construct(string $name = null)
101
-    {
102
-        $this->definition = new InputDefinition();
103
-
104
-        if (null === $name && null !== $name = static::getDefaultName()) {
105
-            $aliases = explode('|', $name);
106
-
107
-            if ('' === $name = array_shift($aliases)) {
108
-                $this->setHidden(true);
109
-                $name = array_shift($aliases);
110
-            }
111
-
112
-            $this->setAliases($aliases);
113
-        }
114
-
115
-        if (null !== $name) {
116
-            $this->setName($name);
117
-        }
118
-
119
-        if ('' === $this->description) {
120
-            $this->setDescription(static::getDefaultDescription() ?? '');
121
-        }
122
-
123
-        $this->configure();
124
-    }
125
-
126
-    /**
127
-     * Ignores validation errors.
128
-     *
129
-     * This is mainly useful for the help command.
130
-     */
131
-    public function ignoreValidationErrors()
132
-    {
133
-        $this->ignoreValidationErrors = true;
134
-    }
135
-
136
-    public function setApplication(Application $application = null)
137
-    {
138
-        $this->application = $application;
139
-        if ($application) {
140
-            $this->setHelperSet($application->getHelperSet());
141
-        } else {
142
-            $this->helperSet = null;
143
-        }
144
-
145
-        $this->fullDefinition = null;
146
-    }
147
-
148
-    public function setHelperSet(HelperSet $helperSet)
149
-    {
150
-        $this->helperSet = $helperSet;
151
-    }
152
-
153
-    /**
154
-     * Gets the helper set.
155
-     *
156
-     * @return HelperSet|null A HelperSet instance
157
-     */
158
-    public function getHelperSet()
159
-    {
160
-        return $this->helperSet;
161
-    }
162
-
163
-    /**
164
-     * Gets the application instance for this command.
165
-     *
166
-     * @return Application|null An Application instance
167
-     */
168
-    public function getApplication()
169
-    {
170
-        return $this->application;
171
-    }
172
-
173
-    /**
174
-     * Checks whether the command is enabled or not in the current environment.
175
-     *
176
-     * Override this to check for x or y and return false if the command can not
177
-     * run properly under the current conditions.
178
-     *
179
-     * @return bool
180
-     */
181
-    public function isEnabled()
182
-    {
183
-        return true;
184
-    }
185
-
186
-    /**
187
-     * Configures the current command.
188
-     */
189
-    protected function configure()
190
-    {
191
-    }
192
-
193
-    /**
194
-     * Executes the current command.
195
-     *
196
-     * This method is not abstract because you can use this class
197
-     * as a concrete class. In this case, instead of defining the
198
-     * execute() method, you set the code to execute by passing
199
-     * a Closure to the setCode() method.
200
-     *
201
-     * @return int 0 if everything went fine, or an exit code
202
-     *
203
-     * @throws LogicException When this abstract method is not implemented
204
-     *
205
-     * @see setCode()
206
-     */
207
-    protected function execute(InputInterface $input, OutputInterface $output)
208
-    {
209
-        throw new LogicException('You must override the execute() method in the concrete command class.');
210
-    }
211
-
212
-    /**
213
-     * Interacts with the user.
214
-     *
215
-     * This method is executed before the InputDefinition is validated.
216
-     * This means that this is the only place where the command can
217
-     * interactively ask for values of missing required arguments.
218
-     */
219
-    protected function interact(InputInterface $input, OutputInterface $output)
220
-    {
221
-    }
222
-
223
-    /**
224
-     * Initializes the command after the input has been bound and before the input
225
-     * is validated.
226
-     *
227
-     * This is mainly useful when a lot of commands extends one main command
228
-     * where some things need to be initialized based on the input arguments and options.
229
-     *
230
-     * @see InputInterface::bind()
231
-     * @see InputInterface::validate()
232
-     */
233
-    protected function initialize(InputInterface $input, OutputInterface $output)
234
-    {
235
-    }
236
-
237
-    /**
238
-     * Runs the command.
239
-     *
240
-     * The code to execute is either defined directly with the
241
-     * setCode() method or by overriding the execute() method
242
-     * in a sub-class.
243
-     *
244
-     * @return int The command exit code
245
-     *
246
-     * @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}.
247
-     *
248
-     * @see setCode()
249
-     * @see execute()
250
-     */
251
-    public function run(InputInterface $input, OutputInterface $output)
252
-    {
253
-        // add the application arguments and options
254
-        $this->mergeApplicationDefinition();
255
-
256
-        // bind the input against the command specific arguments/options
257
-        try {
258
-            $input->bind($this->getDefinition());
259
-        } catch (ExceptionInterface $e) {
260
-            if (!$this->ignoreValidationErrors) {
261
-                throw $e;
262
-            }
263
-        }
264
-
265
-        $this->initialize($input, $output);
266
-
267
-        if (null !== $this->processTitle) {
268
-            if (\function_exists('cli_set_process_title')) {
269
-                if (!@cli_set_process_title($this->processTitle)) {
270
-                    if ('Darwin' === \PHP_OS) {
271
-                        $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
272
-                    } else {
273
-                        cli_set_process_title($this->processTitle);
274
-                    }
275
-                }
276
-            } elseif (\function_exists('setproctitle')) {
277
-                setproctitle($this->processTitle);
278
-            } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
279
-                $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
280
-            }
281
-        }
282
-
283
-        if ($input->isInteractive()) {
284
-            $this->interact($input, $output);
285
-        }
286
-
287
-        // The command name argument is often omitted when a command is executed directly with its run() method.
288
-        // It would fail the validation if we didn't make sure the command argument is present,
289
-        // since it's required by the application.
290
-        if ($input->hasArgument('command') && null === $input->getArgument('command')) {
291
-            $input->setArgument('command', $this->getName());
292
-        }
293
-
294
-        $input->validate();
295
-
296
-        if ($this->code) {
297
-            $statusCode = ($this->code)($input, $output);
298
-        } else {
299
-            $statusCode = $this->execute($input, $output);
300
-
301
-            if (!\is_int($statusCode)) {
302
-                throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type($statusCode)));
303
-            }
304
-        }
305
-
306
-        return is_numeric($statusCode) ? (int) $statusCode : 0;
307
-    }
308
-
309
-    /**
310
-     * Sets the code to execute when running this command.
311
-     *
312
-     * If this method is used, it overrides the code defined
313
-     * in the execute() method.
314
-     *
315
-     * @param callable $code A callable(InputInterface $input, OutputInterface $output)
316
-     *
317
-     * @return $this
318
-     *
319
-     * @throws InvalidArgumentException
320
-     *
321
-     * @see execute()
322
-     */
323
-    public function setCode(callable $code)
324
-    {
325
-        if ($code instanceof \Closure) {
326
-            $r = new \ReflectionFunction($code);
327
-            if (null === $r->getClosureThis()) {
328
-                set_error_handler(static function () {});
329
-                try {
330
-                    if ($c = \Closure::bind($code, $this)) {
331
-                        $code = $c;
332
-                    }
333
-                } finally {
334
-                    restore_error_handler();
335
-                }
336
-            }
337
-        }
338
-
339
-        $this->code = $code;
340
-
341
-        return $this;
342
-    }
343
-
344
-    /**
345
-     * Merges the application definition with the command definition.
346
-     *
347
-     * This method is not part of public API and should not be used directly.
348
-     *
349
-     * @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments
350
-     *
351
-     * @internal
352
-     */
353
-    public function mergeApplicationDefinition(bool $mergeArgs = true)
354
-    {
355
-        if (null === $this->application) {
356
-            return;
357
-        }
358
-
359
-        $this->fullDefinition = new InputDefinition();
360
-        $this->fullDefinition->setOptions($this->definition->getOptions());
361
-        $this->fullDefinition->addOptions($this->application->getDefinition()->getOptions());
362
-
363
-        if ($mergeArgs) {
364
-            $this->fullDefinition->setArguments($this->application->getDefinition()->getArguments());
365
-            $this->fullDefinition->addArguments($this->definition->getArguments());
366
-        } else {
367
-            $this->fullDefinition->setArguments($this->definition->getArguments());
368
-        }
369
-    }
370
-
371
-    /**
372
-     * Sets an array of argument and option instances.
373
-     *
374
-     * @param array|InputDefinition $definition An array of argument and option instances or a definition instance
375
-     *
376
-     * @return $this
377
-     */
378
-    public function setDefinition($definition)
379
-    {
380
-        if ($definition instanceof InputDefinition) {
381
-            $this->definition = $definition;
382
-        } else {
383
-            $this->definition->setDefinition($definition);
384
-        }
385
-
386
-        $this->fullDefinition = null;
387
-
388
-        return $this;
389
-    }
390
-
391
-    /**
392
-     * Gets the InputDefinition attached to this Command.
393
-     *
394
-     * @return InputDefinition An InputDefinition instance
395
-     */
396
-    public function getDefinition()
397
-    {
398
-        return $this->fullDefinition ?? $this->getNativeDefinition();
399
-    }
400
-
401
-    /**
402
-     * Gets the InputDefinition to be used to create representations of this Command.
403
-     *
404
-     * Can be overridden to provide the original command representation when it would otherwise
405
-     * be changed by merging with the application InputDefinition.
406
-     *
407
-     * This method is not part of public API and should not be used directly.
408
-     *
409
-     * @return InputDefinition An InputDefinition instance
410
-     */
411
-    public function getNativeDefinition()
412
-    {
413
-        if (null === $this->definition) {
414
-            throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
415
-        }
416
-
417
-        return $this->definition;
418
-    }
419
-
420
-    /**
421
-     * Adds an argument.
422
-     *
423
-     * @param int|null $mode    The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
424
-     * @param mixed    $default The default value (for InputArgument::OPTIONAL mode only)
425
-     *
426
-     * @throws InvalidArgumentException When argument mode is not valid
427
-     *
428
-     * @return $this
429
-     */
430
-    public function addArgument(string $name, int $mode = null, string $description = '', $default = null)
431
-    {
432
-        $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
433
-        if (null !== $this->fullDefinition) {
434
-            $this->fullDefinition->addArgument(new InputArgument($name, $mode, $description, $default));
435
-        }
436
-
437
-        return $this;
438
-    }
439
-
440
-    /**
441
-     * Adds an option.
442
-     *
443
-     * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
444
-     * @param int|null          $mode     The option mode: One of the InputOption::VALUE_* constants
445
-     * @param mixed             $default  The default value (must be null for InputOption::VALUE_NONE)
446
-     *
447
-     * @throws InvalidArgumentException If option mode is invalid or incompatible
448
-     *
449
-     * @return $this
450
-     */
451
-    public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
452
-    {
453
-        $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
454
-        if (null !== $this->fullDefinition) {
455
-            $this->fullDefinition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
456
-        }
457
-
458
-        return $this;
459
-    }
460
-
461
-    /**
462
-     * Sets the name of the command.
463
-     *
464
-     * This method can set both the namespace and the name if
465
-     * you separate them by a colon (:)
466
-     *
467
-     *     $command->setName('foo:bar');
468
-     *
469
-     * @return $this
470
-     *
471
-     * @throws InvalidArgumentException When the name is invalid
472
-     */
473
-    public function setName(string $name)
474
-    {
475
-        $this->validateName($name);
476
-
477
-        $this->name = $name;
478
-
479
-        return $this;
480
-    }
481
-
482
-    /**
483
-     * Sets the process title of the command.
484
-     *
485
-     * This feature should be used only when creating a long process command,
486
-     * like a daemon.
487
-     *
488
-     * @return $this
489
-     */
490
-    public function setProcessTitle(string $title)
491
-    {
492
-        $this->processTitle = $title;
493
-
494
-        return $this;
495
-    }
496
-
497
-    /**
498
-     * Returns the command name.
499
-     *
500
-     * @return string|null
501
-     */
502
-    public function getName()
503
-    {
504
-        return $this->name;
505
-    }
506
-
507
-    /**
508
-     * @param bool $hidden Whether or not the command should be hidden from the list of commands
509
-     *                     The default value will be true in Symfony 6.0
510
-     *
511
-     * @return $this
512
-     *
513
-     * @final since Symfony 5.1
514
-     */
515
-    public function setHidden(bool $hidden /*= true*/)
516
-    {
517
-        $this->hidden = $hidden;
518
-
519
-        return $this;
520
-    }
521
-
522
-    /**
523
-     * @return bool whether the command should be publicly shown or not
524
-     */
525
-    public function isHidden()
526
-    {
527
-        return $this->hidden;
528
-    }
529
-
530
-    /**
531
-     * Sets the description for the command.
532
-     *
533
-     * @return $this
534
-     */
535
-    public function setDescription(string $description)
536
-    {
537
-        $this->description = $description;
538
-
539
-        return $this;
540
-    }
541
-
542
-    /**
543
-     * Returns the description for the command.
544
-     *
545
-     * @return string The description for the command
546
-     */
547
-    public function getDescription()
548
-    {
549
-        return $this->description;
550
-    }
551
-
552
-    /**
553
-     * Sets the help for the command.
554
-     *
555
-     * @return $this
556
-     */
557
-    public function setHelp(string $help)
558
-    {
559
-        $this->help = $help;
560
-
561
-        return $this;
562
-    }
563
-
564
-    /**
565
-     * Returns the help for the command.
566
-     *
567
-     * @return string The help for the command
568
-     */
569
-    public function getHelp()
570
-    {
571
-        return $this->help;
572
-    }
573
-
574
-    /**
575
-     * Returns the processed help for the command replacing the %command.name% and
576
-     * %command.full_name% patterns with the real values dynamically.
577
-     *
578
-     * @return string The processed help for the command
579
-     */
580
-    public function getProcessedHelp()
581
-    {
582
-        $name = $this->name;
583
-        $isSingleCommand = $this->application && $this->application->isSingleCommand();
584
-
585
-        $placeholders = [
586
-            '%command.name%',
587
-            '%command.full_name%',
588
-        ];
589
-        $replacements = [
590
-            $name,
591
-            $isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
592
-        ];
593
-
594
-        return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
595
-    }
596
-
597
-    /**
598
-     * Sets the aliases for the command.
599
-     *
600
-     * @param string[] $aliases An array of aliases for the command
601
-     *
602
-     * @return $this
603
-     *
604
-     * @throws InvalidArgumentException When an alias is invalid
605
-     */
606
-    public function setAliases(iterable $aliases)
607
-    {
608
-        $list = [];
609
-
610
-        foreach ($aliases as $alias) {
611
-            $this->validateName($alias);
612
-            $list[] = $alias;
613
-        }
614
-
615
-        $this->aliases = \is_array($aliases) ? $aliases : $list;
616
-
617
-        return $this;
618
-    }
619
-
620
-    /**
621
-     * Returns the aliases for the command.
622
-     *
623
-     * @return array An array of aliases for the command
624
-     */
625
-    public function getAliases()
626
-    {
627
-        return $this->aliases;
628
-    }
629
-
630
-    /**
631
-     * Returns the synopsis for the command.
632
-     *
633
-     * @param bool $short Whether to show the short version of the synopsis (with options folded) or not
634
-     *
635
-     * @return string The synopsis
636
-     */
637
-    public function getSynopsis(bool $short = false)
638
-    {
639
-        $key = $short ? 'short' : 'long';
640
-
641
-        if (!isset($this->synopsis[$key])) {
642
-            $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
643
-        }
644
-
645
-        return $this->synopsis[$key];
646
-    }
647
-
648
-    /**
649
-     * Add a command usage example, it'll be prefixed with the command name.
650
-     *
651
-     * @return $this
652
-     */
653
-    public function addUsage(string $usage)
654
-    {
655
-        if (!str_starts_with($usage, $this->name)) {
656
-            $usage = sprintf('%s %s', $this->name, $usage);
657
-        }
658
-
659
-        $this->usages[] = $usage;
660
-
661
-        return $this;
662
-    }
663
-
664
-    /**
665
-     * Returns alternative usages of the command.
666
-     *
667
-     * @return array
668
-     */
669
-    public function getUsages()
670
-    {
671
-        return $this->usages;
672
-    }
673
-
674
-    /**
675
-     * Gets a helper instance by name.
676
-     *
677
-     * @return mixed The helper value
678
-     *
679
-     * @throws LogicException           if no HelperSet is defined
680
-     * @throws InvalidArgumentException if the helper is not defined
681
-     */
682
-    public function getHelper(string $name)
683
-    {
684
-        if (null === $this->helperSet) {
685
-            throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
686
-        }
687
-
688
-        return $this->helperSet->get($name);
689
-    }
690
-
691
-    /**
692
-     * Validates a command name.
693
-     *
694
-     * It must be non-empty and parts can optionally be separated by ":".
695
-     *
696
-     * @throws InvalidArgumentException When the name is invalid
697
-     */
698
-    private function validateName(string $name)
699
-    {
700
-        if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
701
-            throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
702
-        }
703
-    }
33
+	// see https://tldp.org/LDP/abs/html/exitcodes.html
34
+	public const SUCCESS = 0;
35
+	public const FAILURE = 1;
36
+	public const INVALID = 2;
37
+
38
+	/**
39
+	 * @var string|null The default command name
40
+	 */
41
+	protected static $defaultName;
42
+
43
+	/**
44
+	 * @var string|null The default command description
45
+	 */
46
+	protected static $defaultDescription;
47
+
48
+	private $application;
49
+	private $name;
50
+	private $processTitle;
51
+	private $aliases = [];
52
+	private $definition;
53
+	private $hidden = false;
54
+	private $help = '';
55
+	private $description = '';
56
+	private $fullDefinition;
57
+	private $ignoreValidationErrors = false;
58
+	private $code;
59
+	private $synopsis = [];
60
+	private $usages = [];
61
+	private $helperSet;
62
+
63
+	/**
64
+	 * @return string|null The default command name or null when no default name is set
65
+	 */
66
+	public static function getDefaultName()
67
+	{
68
+		$class = static::class;
69
+
70
+		if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
71
+			return $attribute[0]->newInstance()->name;
72
+		}
73
+
74
+		$r = new \ReflectionProperty($class, 'defaultName');
75
+
76
+		return $class === $r->class ? static::$defaultName : null;
77
+	}
78
+
79
+	/**
80
+	 * @return string|null The default command description or null when no default description is set
81
+	 */
82
+	public static function getDefaultDescription(): ?string
83
+	{
84
+		$class = static::class;
85
+
86
+		if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
87
+			return $attribute[0]->newInstance()->description;
88
+		}
89
+
90
+		$r = new \ReflectionProperty($class, 'defaultDescription');
91
+
92
+		return $class === $r->class ? static::$defaultDescription : null;
93
+	}
94
+
95
+	/**
96
+	 * @param string|null $name The name of the command; passing null means it must be set in configure()
97
+	 *
98
+	 * @throws LogicException When the command name is empty
99
+	 */
100
+	public function __construct(string $name = null)
101
+	{
102
+		$this->definition = new InputDefinition();
103
+
104
+		if (null === $name && null !== $name = static::getDefaultName()) {
105
+			$aliases = explode('|', $name);
106
+
107
+			if ('' === $name = array_shift($aliases)) {
108
+				$this->setHidden(true);
109
+				$name = array_shift($aliases);
110
+			}
111
+
112
+			$this->setAliases($aliases);
113
+		}
114
+
115
+		if (null !== $name) {
116
+			$this->setName($name);
117
+		}
118
+
119
+		if ('' === $this->description) {
120
+			$this->setDescription(static::getDefaultDescription() ?? '');
121
+		}
122
+
123
+		$this->configure();
124
+	}
125
+
126
+	/**
127
+	 * Ignores validation errors.
128
+	 *
129
+	 * This is mainly useful for the help command.
130
+	 */
131
+	public function ignoreValidationErrors()
132
+	{
133
+		$this->ignoreValidationErrors = true;
134
+	}
135
+
136
+	public function setApplication(Application $application = null)
137
+	{
138
+		$this->application = $application;
139
+		if ($application) {
140
+			$this->setHelperSet($application->getHelperSet());
141
+		} else {
142
+			$this->helperSet = null;
143
+		}
144
+
145
+		$this->fullDefinition = null;
146
+	}
147
+
148
+	public function setHelperSet(HelperSet $helperSet)
149
+	{
150
+		$this->helperSet = $helperSet;
151
+	}
152
+
153
+	/**
154
+	 * Gets the helper set.
155
+	 *
156
+	 * @return HelperSet|null A HelperSet instance
157
+	 */
158
+	public function getHelperSet()
159
+	{
160
+		return $this->helperSet;
161
+	}
162
+
163
+	/**
164
+	 * Gets the application instance for this command.
165
+	 *
166
+	 * @return Application|null An Application instance
167
+	 */
168
+	public function getApplication()
169
+	{
170
+		return $this->application;
171
+	}
172
+
173
+	/**
174
+	 * Checks whether the command is enabled or not in the current environment.
175
+	 *
176
+	 * Override this to check for x or y and return false if the command can not
177
+	 * run properly under the current conditions.
178
+	 *
179
+	 * @return bool
180
+	 */
181
+	public function isEnabled()
182
+	{
183
+		return true;
184
+	}
185
+
186
+	/**
187
+	 * Configures the current command.
188
+	 */
189
+	protected function configure()
190
+	{
191
+	}
192
+
193
+	/**
194
+	 * Executes the current command.
195
+	 *
196
+	 * This method is not abstract because you can use this class
197
+	 * as a concrete class. In this case, instead of defining the
198
+	 * execute() method, you set the code to execute by passing
199
+	 * a Closure to the setCode() method.
200
+	 *
201
+	 * @return int 0 if everything went fine, or an exit code
202
+	 *
203
+	 * @throws LogicException When this abstract method is not implemented
204
+	 *
205
+	 * @see setCode()
206
+	 */
207
+	protected function execute(InputInterface $input, OutputInterface $output)
208
+	{
209
+		throw new LogicException('You must override the execute() method in the concrete command class.');
210
+	}
211
+
212
+	/**
213
+	 * Interacts with the user.
214
+	 *
215
+	 * This method is executed before the InputDefinition is validated.
216
+	 * This means that this is the only place where the command can
217
+	 * interactively ask for values of missing required arguments.
218
+	 */
219
+	protected function interact(InputInterface $input, OutputInterface $output)
220
+	{
221
+	}
222
+
223
+	/**
224
+	 * Initializes the command after the input has been bound and before the input
225
+	 * is validated.
226
+	 *
227
+	 * This is mainly useful when a lot of commands extends one main command
228
+	 * where some things need to be initialized based on the input arguments and options.
229
+	 *
230
+	 * @see InputInterface::bind()
231
+	 * @see InputInterface::validate()
232
+	 */
233
+	protected function initialize(InputInterface $input, OutputInterface $output)
234
+	{
235
+	}
236
+
237
+	/**
238
+	 * Runs the command.
239
+	 *
240
+	 * The code to execute is either defined directly with the
241
+	 * setCode() method or by overriding the execute() method
242
+	 * in a sub-class.
243
+	 *
244
+	 * @return int The command exit code
245
+	 *
246
+	 * @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}.
247
+	 *
248
+	 * @see setCode()
249
+	 * @see execute()
250
+	 */
251
+	public function run(InputInterface $input, OutputInterface $output)
252
+	{
253
+		// add the application arguments and options
254
+		$this->mergeApplicationDefinition();
255
+
256
+		// bind the input against the command specific arguments/options
257
+		try {
258
+			$input->bind($this->getDefinition());
259
+		} catch (ExceptionInterface $e) {
260
+			if (!$this->ignoreValidationErrors) {
261
+				throw $e;
262
+			}
263
+		}
264
+
265
+		$this->initialize($input, $output);
266
+
267
+		if (null !== $this->processTitle) {
268
+			if (\function_exists('cli_set_process_title')) {
269
+				if (!@cli_set_process_title($this->processTitle)) {
270
+					if ('Darwin' === \PHP_OS) {
271
+						$output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
272
+					} else {
273
+						cli_set_process_title($this->processTitle);
274
+					}
275
+				}
276
+			} elseif (\function_exists('setproctitle')) {
277
+				setproctitle($this->processTitle);
278
+			} elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
279
+				$output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
280
+			}
281
+		}
282
+
283
+		if ($input->isInteractive()) {
284
+			$this->interact($input, $output);
285
+		}
286
+
287
+		// The command name argument is often omitted when a command is executed directly with its run() method.
288
+		// It would fail the validation if we didn't make sure the command argument is present,
289
+		// since it's required by the application.
290
+		if ($input->hasArgument('command') && null === $input->getArgument('command')) {
291
+			$input->setArgument('command', $this->getName());
292
+		}
293
+
294
+		$input->validate();
295
+
296
+		if ($this->code) {
297
+			$statusCode = ($this->code)($input, $output);
298
+		} else {
299
+			$statusCode = $this->execute($input, $output);
300
+
301
+			if (!\is_int($statusCode)) {
302
+				throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type($statusCode)));
303
+			}
304
+		}
305
+
306
+		return is_numeric($statusCode) ? (int) $statusCode : 0;
307
+	}
308
+
309
+	/**
310
+	 * Sets the code to execute when running this command.
311
+	 *
312
+	 * If this method is used, it overrides the code defined
313
+	 * in the execute() method.
314
+	 *
315
+	 * @param callable $code A callable(InputInterface $input, OutputInterface $output)
316
+	 *
317
+	 * @return $this
318
+	 *
319
+	 * @throws InvalidArgumentException
320
+	 *
321
+	 * @see execute()
322
+	 */
323
+	public function setCode(callable $code)
324
+	{
325
+		if ($code instanceof \Closure) {
326
+			$r = new \ReflectionFunction($code);
327
+			if (null === $r->getClosureThis()) {
328
+				set_error_handler(static function () {});
329
+				try {
330
+					if ($c = \Closure::bind($code, $this)) {
331
+						$code = $c;
332
+					}
333
+				} finally {
334
+					restore_error_handler();
335
+				}
336
+			}
337
+		}
338
+
339
+		$this->code = $code;
340
+
341
+		return $this;
342
+	}
343
+
344
+	/**
345
+	 * Merges the application definition with the command definition.
346
+	 *
347
+	 * This method is not part of public API and should not be used directly.
348
+	 *
349
+	 * @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments
350
+	 *
351
+	 * @internal
352
+	 */
353
+	public function mergeApplicationDefinition(bool $mergeArgs = true)
354
+	{
355
+		if (null === $this->application) {
356
+			return;
357
+		}
358
+
359
+		$this->fullDefinition = new InputDefinition();
360
+		$this->fullDefinition->setOptions($this->definition->getOptions());
361
+		$this->fullDefinition->addOptions($this->application->getDefinition()->getOptions());
362
+
363
+		if ($mergeArgs) {
364
+			$this->fullDefinition->setArguments($this->application->getDefinition()->getArguments());
365
+			$this->fullDefinition->addArguments($this->definition->getArguments());
366
+		} else {
367
+			$this->fullDefinition->setArguments($this->definition->getArguments());
368
+		}
369
+	}
370
+
371
+	/**
372
+	 * Sets an array of argument and option instances.
373
+	 *
374
+	 * @param array|InputDefinition $definition An array of argument and option instances or a definition instance
375
+	 *
376
+	 * @return $this
377
+	 */
378
+	public function setDefinition($definition)
379
+	{
380
+		if ($definition instanceof InputDefinition) {
381
+			$this->definition = $definition;
382
+		} else {
383
+			$this->definition->setDefinition($definition);
384
+		}
385
+
386
+		$this->fullDefinition = null;
387
+
388
+		return $this;
389
+	}
390
+
391
+	/**
392
+	 * Gets the InputDefinition attached to this Command.
393
+	 *
394
+	 * @return InputDefinition An InputDefinition instance
395
+	 */
396
+	public function getDefinition()
397
+	{
398
+		return $this->fullDefinition ?? $this->getNativeDefinition();
399
+	}
400
+
401
+	/**
402
+	 * Gets the InputDefinition to be used to create representations of this Command.
403
+	 *
404
+	 * Can be overridden to provide the original command representation when it would otherwise
405
+	 * be changed by merging with the application InputDefinition.
406
+	 *
407
+	 * This method is not part of public API and should not be used directly.
408
+	 *
409
+	 * @return InputDefinition An InputDefinition instance
410
+	 */
411
+	public function getNativeDefinition()
412
+	{
413
+		if (null === $this->definition) {
414
+			throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
415
+		}
416
+
417
+		return $this->definition;
418
+	}
419
+
420
+	/**
421
+	 * Adds an argument.
422
+	 *
423
+	 * @param int|null $mode    The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
424
+	 * @param mixed    $default The default value (for InputArgument::OPTIONAL mode only)
425
+	 *
426
+	 * @throws InvalidArgumentException When argument mode is not valid
427
+	 *
428
+	 * @return $this
429
+	 */
430
+	public function addArgument(string $name, int $mode = null, string $description = '', $default = null)
431
+	{
432
+		$this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
433
+		if (null !== $this->fullDefinition) {
434
+			$this->fullDefinition->addArgument(new InputArgument($name, $mode, $description, $default));
435
+		}
436
+
437
+		return $this;
438
+	}
439
+
440
+	/**
441
+	 * Adds an option.
442
+	 *
443
+	 * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
444
+	 * @param int|null          $mode     The option mode: One of the InputOption::VALUE_* constants
445
+	 * @param mixed             $default  The default value (must be null for InputOption::VALUE_NONE)
446
+	 *
447
+	 * @throws InvalidArgumentException If option mode is invalid or incompatible
448
+	 *
449
+	 * @return $this
450
+	 */
451
+	public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
452
+	{
453
+		$this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
454
+		if (null !== $this->fullDefinition) {
455
+			$this->fullDefinition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
456
+		}
457
+
458
+		return $this;
459
+	}
460
+
461
+	/**
462
+	 * Sets the name of the command.
463
+	 *
464
+	 * This method can set both the namespace and the name if
465
+	 * you separate them by a colon (:)
466
+	 *
467
+	 *     $command->setName('foo:bar');
468
+	 *
469
+	 * @return $this
470
+	 *
471
+	 * @throws InvalidArgumentException When the name is invalid
472
+	 */
473
+	public function setName(string $name)
474
+	{
475
+		$this->validateName($name);
476
+
477
+		$this->name = $name;
478
+
479
+		return $this;
480
+	}
481
+
482
+	/**
483
+	 * Sets the process title of the command.
484
+	 *
485
+	 * This feature should be used only when creating a long process command,
486
+	 * like a daemon.
487
+	 *
488
+	 * @return $this
489
+	 */
490
+	public function setProcessTitle(string $title)
491
+	{
492
+		$this->processTitle = $title;
493
+
494
+		return $this;
495
+	}
496
+
497
+	/**
498
+	 * Returns the command name.
499
+	 *
500
+	 * @return string|null
501
+	 */
502
+	public function getName()
503
+	{
504
+		return $this->name;
505
+	}
506
+
507
+	/**
508
+	 * @param bool $hidden Whether or not the command should be hidden from the list of commands
509
+	 *                     The default value will be true in Symfony 6.0
510
+	 *
511
+	 * @return $this
512
+	 *
513
+	 * @final since Symfony 5.1
514
+	 */
515
+	public function setHidden(bool $hidden /*= true*/)
516
+	{
517
+		$this->hidden = $hidden;
518
+
519
+		return $this;
520
+	}
521
+
522
+	/**
523
+	 * @return bool whether the command should be publicly shown or not
524
+	 */
525
+	public function isHidden()
526
+	{
527
+		return $this->hidden;
528
+	}
529
+
530
+	/**
531
+	 * Sets the description for the command.
532
+	 *
533
+	 * @return $this
534
+	 */
535
+	public function setDescription(string $description)
536
+	{
537
+		$this->description = $description;
538
+
539
+		return $this;
540
+	}
541
+
542
+	/**
543
+	 * Returns the description for the command.
544
+	 *
545
+	 * @return string The description for the command
546
+	 */
547
+	public function getDescription()
548
+	{
549
+		return $this->description;
550
+	}
551
+
552
+	/**
553
+	 * Sets the help for the command.
554
+	 *
555
+	 * @return $this
556
+	 */
557
+	public function setHelp(string $help)
558
+	{
559
+		$this->help = $help;
560
+
561
+		return $this;
562
+	}
563
+
564
+	/**
565
+	 * Returns the help for the command.
566
+	 *
567
+	 * @return string The help for the command
568
+	 */
569
+	public function getHelp()
570
+	{
571
+		return $this->help;
572
+	}
573
+
574
+	/**
575
+	 * Returns the processed help for the command replacing the %command.name% and
576
+	 * %command.full_name% patterns with the real values dynamically.
577
+	 *
578
+	 * @return string The processed help for the command
579
+	 */
580
+	public function getProcessedHelp()
581
+	{
582
+		$name = $this->name;
583
+		$isSingleCommand = $this->application && $this->application->isSingleCommand();
584
+
585
+		$placeholders = [
586
+			'%command.name%',
587
+			'%command.full_name%',
588
+		];
589
+		$replacements = [
590
+			$name,
591
+			$isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
592
+		];
593
+
594
+		return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
595
+	}
596
+
597
+	/**
598
+	 * Sets the aliases for the command.
599
+	 *
600
+	 * @param string[] $aliases An array of aliases for the command
601
+	 *
602
+	 * @return $this
603
+	 *
604
+	 * @throws InvalidArgumentException When an alias is invalid
605
+	 */
606
+	public function setAliases(iterable $aliases)
607
+	{
608
+		$list = [];
609
+
610
+		foreach ($aliases as $alias) {
611
+			$this->validateName($alias);
612
+			$list[] = $alias;
613
+		}
614
+
615
+		$this->aliases = \is_array($aliases) ? $aliases : $list;
616
+
617
+		return $this;
618
+	}
619
+
620
+	/**
621
+	 * Returns the aliases for the command.
622
+	 *
623
+	 * @return array An array of aliases for the command
624
+	 */
625
+	public function getAliases()
626
+	{
627
+		return $this->aliases;
628
+	}
629
+
630
+	/**
631
+	 * Returns the synopsis for the command.
632
+	 *
633
+	 * @param bool $short Whether to show the short version of the synopsis (with options folded) or not
634
+	 *
635
+	 * @return string The synopsis
636
+	 */
637
+	public function getSynopsis(bool $short = false)
638
+	{
639
+		$key = $short ? 'short' : 'long';
640
+
641
+		if (!isset($this->synopsis[$key])) {
642
+			$this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
643
+		}
644
+
645
+		return $this->synopsis[$key];
646
+	}
647
+
648
+	/**
649
+	 * Add a command usage example, it'll be prefixed with the command name.
650
+	 *
651
+	 * @return $this
652
+	 */
653
+	public function addUsage(string $usage)
654
+	{
655
+		if (!str_starts_with($usage, $this->name)) {
656
+			$usage = sprintf('%s %s', $this->name, $usage);
657
+		}
658
+
659
+		$this->usages[] = $usage;
660
+
661
+		return $this;
662
+	}
663
+
664
+	/**
665
+	 * Returns alternative usages of the command.
666
+	 *
667
+	 * @return array
668
+	 */
669
+	public function getUsages()
670
+	{
671
+		return $this->usages;
672
+	}
673
+
674
+	/**
675
+	 * Gets a helper instance by name.
676
+	 *
677
+	 * @return mixed The helper value
678
+	 *
679
+	 * @throws LogicException           if no HelperSet is defined
680
+	 * @throws InvalidArgumentException if the helper is not defined
681
+	 */
682
+	public function getHelper(string $name)
683
+	{
684
+		if (null === $this->helperSet) {
685
+			throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
686
+		}
687
+
688
+		return $this->helperSet->get($name);
689
+	}
690
+
691
+	/**
692
+	 * Validates a command name.
693
+	 *
694
+	 * It must be non-empty and parts can optionally be separated by ":".
695
+	 *
696
+	 * @throws InvalidArgumentException When the name is invalid
697
+	 */
698
+	private function validateName(string $name)
699
+	{
700
+		if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
701
+			throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
702
+		}
703
+	}
704 704
 }
Please login to merge, or discard this patch.
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     private $application;
49 49
     private $name;
50 50
     private $processTitle;
51
-    private $aliases = [];
51
+    private $aliases = [ ];
52 52
     private $definition;
53 53
     private $hidden = false;
54 54
     private $help = '';
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
     private $fullDefinition;
57 57
     private $ignoreValidationErrors = false;
58 58
     private $code;
59
-    private $synopsis = [];
60
-    private $usages = [];
59
+    private $synopsis = [ ];
60
+    private $usages = [ ];
61 61
     private $helperSet;
62 62
 
63 63
     /**
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $class = static::class;
69 69
 
70
-        if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
71
-            return $attribute[0]->newInstance()->name;
70
+        if ( \PHP_VERSION_ID >= 80000 && $attribute = ( new \ReflectionClass( $class ) )->getAttributes( AsCommand::class ) ) {
71
+            return $attribute[ 0 ]->newInstance()->name;
72 72
         }
73 73
 
74
-        $r = new \ReflectionProperty($class, 'defaultName');
74
+        $r = new \ReflectionProperty( $class, 'defaultName' );
75 75
 
76 76
         return $class === $r->class ? static::$defaultName : null;
77 77
     }
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
     {
84 84
         $class = static::class;
85 85
 
86
-        if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
87
-            return $attribute[0]->newInstance()->description;
86
+        if ( \PHP_VERSION_ID >= 80000 && $attribute = ( new \ReflectionClass( $class ) )->getAttributes( AsCommand::class ) ) {
87
+            return $attribute[ 0 ]->newInstance()->description;
88 88
         }
89 89
 
90
-        $r = new \ReflectionProperty($class, 'defaultDescription');
90
+        $r = new \ReflectionProperty( $class, 'defaultDescription' );
91 91
 
92 92
         return $class === $r->class ? static::$defaultDescription : null;
93 93
     }
@@ -97,27 +97,27 @@  discard block
 block discarded – undo
97 97
      *
98 98
      * @throws LogicException When the command name is empty
99 99
      */
100
-    public function __construct(string $name = null)
100
+    public function __construct( string $name = null )
101 101
     {
102 102
         $this->definition = new InputDefinition();
103 103
 
104
-        if (null === $name && null !== $name = static::getDefaultName()) {
105
-            $aliases = explode('|', $name);
104
+        if ( null === $name && null !== $name = static::getDefaultName() ) {
105
+            $aliases = explode( '|', $name );
106 106
 
107
-            if ('' === $name = array_shift($aliases)) {
108
-                $this->setHidden(true);
109
-                $name = array_shift($aliases);
107
+            if ( '' === $name = array_shift( $aliases ) ) {
108
+                $this->setHidden( true );
109
+                $name = array_shift( $aliases );
110 110
             }
111 111
 
112
-            $this->setAliases($aliases);
112
+            $this->setAliases( $aliases );
113 113
         }
114 114
 
115
-        if (null !== $name) {
116
-            $this->setName($name);
115
+        if ( null !== $name ) {
116
+            $this->setName( $name );
117 117
         }
118 118
 
119
-        if ('' === $this->description) {
120
-            $this->setDescription(static::getDefaultDescription() ?? '');
119
+        if ( '' === $this->description ) {
120
+            $this->setDescription( static::getDefaultDescription() ?? '' );
121 121
         }
122 122
 
123 123
         $this->configure();
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
         $this->ignoreValidationErrors = true;
134 134
     }
135 135
 
136
-    public function setApplication(Application $application = null)
136
+    public function setApplication( Application $application = null )
137 137
     {
138 138
         $this->application = $application;
139
-        if ($application) {
140
-            $this->setHelperSet($application->getHelperSet());
139
+        if ( $application ) {
140
+            $this->setHelperSet( $application->getHelperSet() );
141 141
         } else {
142 142
             $this->helperSet = null;
143 143
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         $this->fullDefinition = null;
146 146
     }
147 147
 
148
-    public function setHelperSet(HelperSet $helperSet)
148
+    public function setHelperSet( HelperSet $helperSet )
149 149
     {
150 150
         $this->helperSet = $helperSet;
151 151
     }
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
      *
205 205
      * @see setCode()
206 206
      */
207
-    protected function execute(InputInterface $input, OutputInterface $output)
207
+    protected function execute( InputInterface $input, OutputInterface $output )
208 208
     {
209
-        throw new LogicException('You must override the execute() method in the concrete command class.');
209
+        throw new LogicException( 'You must override the execute() method in the concrete command class.' );
210 210
     }
211 211
 
212 212
     /**
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      * This means that this is the only place where the command can
217 217
      * interactively ask for values of missing required arguments.
218 218
      */
219
-    protected function interact(InputInterface $input, OutputInterface $output)
219
+    protected function interact( InputInterface $input, OutputInterface $output )
220 220
     {
221 221
     }
222 222
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      * @see InputInterface::bind()
231 231
      * @see InputInterface::validate()
232 232
      */
233
-    protected function initialize(InputInterface $input, OutputInterface $output)
233
+    protected function initialize( InputInterface $input, OutputInterface $output )
234 234
     {
235 235
     }
236 236
 
@@ -248,62 +248,62 @@  discard block
 block discarded – undo
248 248
      * @see setCode()
249 249
      * @see execute()
250 250
      */
251
-    public function run(InputInterface $input, OutputInterface $output)
251
+    public function run( InputInterface $input, OutputInterface $output )
252 252
     {
253 253
         // add the application arguments and options
254 254
         $this->mergeApplicationDefinition();
255 255
 
256 256
         // bind the input against the command specific arguments/options
257 257
         try {
258
-            $input->bind($this->getDefinition());
259
-        } catch (ExceptionInterface $e) {
260
-            if (!$this->ignoreValidationErrors) {
258
+            $input->bind( $this->getDefinition() );
259
+        } catch ( ExceptionInterface $e ) {
260
+            if ( ! $this->ignoreValidationErrors ) {
261 261
                 throw $e;
262 262
             }
263 263
         }
264 264
 
265
-        $this->initialize($input, $output);
265
+        $this->initialize( $input, $output );
266 266
 
267
-        if (null !== $this->processTitle) {
268
-            if (\function_exists('cli_set_process_title')) {
269
-                if (!@cli_set_process_title($this->processTitle)) {
270
-                    if ('Darwin' === \PHP_OS) {
271
-                        $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
267
+        if ( null !== $this->processTitle ) {
268
+            if ( \function_exists( 'cli_set_process_title' ) ) {
269
+                if ( ! @cli_set_process_title( $this->processTitle ) ) {
270
+                    if ( 'Darwin' === \PHP_OS ) {
271
+                        $output->writeln( '<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE );
272 272
                     } else {
273
-                        cli_set_process_title($this->processTitle);
273
+                        cli_set_process_title( $this->processTitle );
274 274
                     }
275 275
                 }
276
-            } elseif (\function_exists('setproctitle')) {
277
-                setproctitle($this->processTitle);
278
-            } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
279
-                $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
276
+            } elseif ( \function_exists( 'setproctitle' ) ) {
277
+                setproctitle( $this->processTitle );
278
+            } elseif ( OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity() ) {
279
+                $output->writeln( '<comment>Install the proctitle PECL to be able to change the process title.</comment>' );
280 280
             }
281 281
         }
282 282
 
283
-        if ($input->isInteractive()) {
284
-            $this->interact($input, $output);
283
+        if ( $input->isInteractive() ) {
284
+            $this->interact( $input, $output );
285 285
         }
286 286
 
287 287
         // The command name argument is often omitted when a command is executed directly with its run() method.
288 288
         // It would fail the validation if we didn't make sure the command argument is present,
289 289
         // since it's required by the application.
290
-        if ($input->hasArgument('command') && null === $input->getArgument('command')) {
291
-            $input->setArgument('command', $this->getName());
290
+        if ( $input->hasArgument( 'command' ) && null === $input->getArgument( 'command' ) ) {
291
+            $input->setArgument( 'command', $this->getName() );
292 292
         }
293 293
 
294 294
         $input->validate();
295 295
 
296
-        if ($this->code) {
297
-            $statusCode = ($this->code)($input, $output);
296
+        if ( $this->code ) {
297
+            $statusCode = ( $this->code )( $input, $output );
298 298
         } else {
299
-            $statusCode = $this->execute($input, $output);
299
+            $statusCode = $this->execute( $input, $output );
300 300
 
301
-            if (!\is_int($statusCode)) {
302
-                throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type($statusCode)));
301
+            if ( ! \is_int( $statusCode ) ) {
302
+                throw new \TypeError( sprintf( 'Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type( $statusCode ) ) );
303 303
             }
304 304
         }
305 305
 
306
-        return is_numeric($statusCode) ? (int) $statusCode : 0;
306
+        return is_numeric( $statusCode ) ? (int)$statusCode : 0;
307 307
     }
308 308
 
309 309
     /**
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
      *
321 321
      * @see execute()
322 322
      */
323
-    public function setCode(callable $code)
323
+    public function setCode( callable $code )
324 324
     {
325
-        if ($code instanceof \Closure) {
326
-            $r = new \ReflectionFunction($code);
327
-            if (null === $r->getClosureThis()) {
328
-                set_error_handler(static function () {});
325
+        if ( $code instanceof \Closure ) {
326
+            $r = new \ReflectionFunction( $code );
327
+            if ( null === $r->getClosureThis() ) {
328
+                set_error_handler( static function() {});
329 329
                 try {
330
-                    if ($c = \Closure::bind($code, $this)) {
330
+                    if ( $c = \Closure::bind( $code, $this ) ) {
331 331
                         $code = $c;
332 332
                     }
333 333
                 } finally {
@@ -350,21 +350,21 @@  discard block
 block discarded – undo
350 350
      *
351 351
      * @internal
352 352
      */
353
-    public function mergeApplicationDefinition(bool $mergeArgs = true)
353
+    public function mergeApplicationDefinition( bool $mergeArgs = true )
354 354
     {
355
-        if (null === $this->application) {
355
+        if ( null === $this->application ) {
356 356
             return;
357 357
         }
358 358
 
359 359
         $this->fullDefinition = new InputDefinition();
360
-        $this->fullDefinition->setOptions($this->definition->getOptions());
361
-        $this->fullDefinition->addOptions($this->application->getDefinition()->getOptions());
360
+        $this->fullDefinition->setOptions( $this->definition->getOptions() );
361
+        $this->fullDefinition->addOptions( $this->application->getDefinition()->getOptions() );
362 362
 
363
-        if ($mergeArgs) {
364
-            $this->fullDefinition->setArguments($this->application->getDefinition()->getArguments());
365
-            $this->fullDefinition->addArguments($this->definition->getArguments());
363
+        if ( $mergeArgs ) {
364
+            $this->fullDefinition->setArguments( $this->application->getDefinition()->getArguments() );
365
+            $this->fullDefinition->addArguments( $this->definition->getArguments() );
366 366
         } else {
367
-            $this->fullDefinition->setArguments($this->definition->getArguments());
367
+            $this->fullDefinition->setArguments( $this->definition->getArguments() );
368 368
         }
369 369
     }
370 370
 
@@ -375,12 +375,12 @@  discard block
 block discarded – undo
375 375
      *
376 376
      * @return $this
377 377
      */
378
-    public function setDefinition($definition)
378
+    public function setDefinition( $definition )
379 379
     {
380
-        if ($definition instanceof InputDefinition) {
380
+        if ( $definition instanceof InputDefinition ) {
381 381
             $this->definition = $definition;
382 382
         } else {
383
-            $this->definition->setDefinition($definition);
383
+            $this->definition->setDefinition( $definition );
384 384
         }
385 385
 
386 386
         $this->fullDefinition = null;
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
      */
411 411
     public function getNativeDefinition()
412 412
     {
413
-        if (null === $this->definition) {
414
-            throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
413
+        if ( null === $this->definition ) {
414
+            throw new LogicException( sprintf( 'Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class ) );
415 415
         }
416 416
 
417 417
         return $this->definition;
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
      *
428 428
      * @return $this
429 429
      */
430
-    public function addArgument(string $name, int $mode = null, string $description = '', $default = null)
430
+    public function addArgument( string $name, int $mode = null, string $description = '', $default = null )
431 431
     {
432
-        $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
433
-        if (null !== $this->fullDefinition) {
434
-            $this->fullDefinition->addArgument(new InputArgument($name, $mode, $description, $default));
432
+        $this->definition->addArgument( new InputArgument( $name, $mode, $description, $default ) );
433
+        if ( null !== $this->fullDefinition ) {
434
+            $this->fullDefinition->addArgument( new InputArgument( $name, $mode, $description, $default ) );
435 435
         }
436 436
 
437 437
         return $this;
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
      *
449 449
      * @return $this
450 450
      */
451
-    public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
451
+    public function addOption( string $name, $shortcut = null, int $mode = null, string $description = '', $default = null )
452 452
     {
453
-        $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
454
-        if (null !== $this->fullDefinition) {
455
-            $this->fullDefinition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
453
+        $this->definition->addOption( new InputOption( $name, $shortcut, $mode, $description, $default ) );
454
+        if ( null !== $this->fullDefinition ) {
455
+            $this->fullDefinition->addOption( new InputOption( $name, $shortcut, $mode, $description, $default ) );
456 456
         }
457 457
 
458 458
         return $this;
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
      *
471 471
      * @throws InvalidArgumentException When the name is invalid
472 472
      */
473
-    public function setName(string $name)
473
+    public function setName( string $name )
474 474
     {
475
-        $this->validateName($name);
475
+        $this->validateName( $name );
476 476
 
477 477
         $this->name = $name;
478 478
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
      *
488 488
      * @return $this
489 489
      */
490
-    public function setProcessTitle(string $title)
490
+    public function setProcessTitle( string $title )
491 491
     {
492 492
         $this->processTitle = $title;
493 493
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
      *
513 513
      * @final since Symfony 5.1
514 514
      */
515
-    public function setHidden(bool $hidden /*= true*/)
515
+    public function setHidden( bool $hidden /*= true*/ )
516 516
     {
517 517
         $this->hidden = $hidden;
518 518
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
      *
533 533
      * @return $this
534 534
      */
535
-    public function setDescription(string $description)
535
+    public function setDescription( string $description )
536 536
     {
537 537
         $this->description = $description;
538 538
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
      *
555 555
      * @return $this
556 556
      */
557
-    public function setHelp(string $help)
557
+    public function setHelp( string $help )
558 558
     {
559 559
         $this->help = $help;
560 560
 
@@ -588,10 +588,10 @@  discard block
 block discarded – undo
588 588
         ];
589 589
         $replacements = [
590 590
             $name,
591
-            $isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
591
+            $isSingleCommand ? $_SERVER[ 'PHP_SELF' ] : $_SERVER[ 'PHP_SELF' ] . ' ' . $name,
592 592
         ];
593 593
 
594
-        return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
594
+        return str_replace( $placeholders, $replacements, $this->getHelp() ?: $this->getDescription() );
595 595
     }
596 596
 
597 597
     /**
@@ -603,16 +603,16 @@  discard block
 block discarded – undo
603 603
      *
604 604
      * @throws InvalidArgumentException When an alias is invalid
605 605
      */
606
-    public function setAliases(iterable $aliases)
606
+    public function setAliases( iterable $aliases )
607 607
     {
608
-        $list = [];
608
+        $list = [ ];
609 609
 
610
-        foreach ($aliases as $alias) {
611
-            $this->validateName($alias);
612
-            $list[] = $alias;
610
+        foreach ( $aliases as $alias ) {
611
+            $this->validateName( $alias );
612
+            $list[ ] = $alias;
613 613
         }
614 614
 
615
-        $this->aliases = \is_array($aliases) ? $aliases : $list;
615
+        $this->aliases = \is_array( $aliases ) ? $aliases : $list;
616 616
 
617 617
         return $this;
618 618
     }
@@ -634,15 +634,15 @@  discard block
 block discarded – undo
634 634
      *
635 635
      * @return string The synopsis
636 636
      */
637
-    public function getSynopsis(bool $short = false)
637
+    public function getSynopsis( bool $short = false )
638 638
     {
639 639
         $key = $short ? 'short' : 'long';
640 640
 
641
-        if (!isset($this->synopsis[$key])) {
642
-            $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
641
+        if ( ! isset( $this->synopsis[ $key ] ) ) {
642
+            $this->synopsis[ $key ] = trim( sprintf( '%s %s', $this->name, $this->definition->getSynopsis( $short ) ) );
643 643
         }
644 644
 
645
-        return $this->synopsis[$key];
645
+        return $this->synopsis[ $key ];
646 646
     }
647 647
 
648 648
     /**
@@ -650,13 +650,13 @@  discard block
 block discarded – undo
650 650
      *
651 651
      * @return $this
652 652
      */
653
-    public function addUsage(string $usage)
653
+    public function addUsage( string $usage )
654 654
     {
655
-        if (!str_starts_with($usage, $this->name)) {
656
-            $usage = sprintf('%s %s', $this->name, $usage);
655
+        if ( ! str_starts_with( $usage, $this->name ) ) {
656
+            $usage = sprintf( '%s %s', $this->name, $usage );
657 657
         }
658 658
 
659
-        $this->usages[] = $usage;
659
+        $this->usages[ ] = $usage;
660 660
 
661 661
         return $this;
662 662
     }
@@ -679,13 +679,13 @@  discard block
 block discarded – undo
679 679
      * @throws LogicException           if no HelperSet is defined
680 680
      * @throws InvalidArgumentException if the helper is not defined
681 681
      */
682
-    public function getHelper(string $name)
682
+    public function getHelper( string $name )
683 683
     {
684
-        if (null === $this->helperSet) {
685
-            throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
684
+        if ( null === $this->helperSet ) {
685
+            throw new LogicException( sprintf( 'Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name ) );
686 686
         }
687 687
 
688
-        return $this->helperSet->get($name);
688
+        return $this->helperSet->get( $name );
689 689
     }
690 690
 
691 691
     /**
@@ -695,10 +695,10 @@  discard block
 block discarded – undo
695 695
      *
696 696
      * @throws InvalidArgumentException When the name is invalid
697 697
      */
698
-    private function validateName(string $name)
698
+    private function validateName( string $name )
699 699
     {
700
-        if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
701
-            throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
700
+        if ( ! preg_match( '/^[^\:]++(\:[^\:]++)*$/', $name ) ) {
701
+            throw new InvalidArgumentException( sprintf( 'Command name "%s" is invalid.', $name ) );
702 702
         }
703 703
     }
704 704
 }
Please login to merge, or discard this patch.
Braces   +38 added lines, -76 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @author Fabien Potencier <[email protected]>
30 30
  */
31
-class Command
32
-{
31
+class Command {
33 32
     // see https://tldp.org/LDP/abs/html/exitcodes.html
34 33
     public const SUCCESS = 0;
35 34
     public const FAILURE = 1;
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
     /**
64 63
      * @return string|null The default command name or null when no default name is set
65 64
      */
66
-    public static function getDefaultName()
67
-    {
65
+    public static function getDefaultName() {
68 66
         $class = static::class;
69 67
 
70 68
         if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
@@ -97,8 +95,7 @@  discard block
 block discarded – undo
97 95
      *
98 96
      * @throws LogicException When the command name is empty
99 97
      */
100
-    public function __construct(string $name = null)
101
-    {
98
+    public function __construct(string $name = null) {
102 99
         $this->definition = new InputDefinition();
103 100
 
104 101
         if (null === $name && null !== $name = static::getDefaultName()) {
@@ -128,13 +125,11 @@  discard block
 block discarded – undo
128 125
      *
129 126
      * This is mainly useful for the help command.
130 127
      */
131
-    public function ignoreValidationErrors()
132
-    {
128
+    public function ignoreValidationErrors() {
133 129
         $this->ignoreValidationErrors = true;
134 130
     }
135 131
 
136
-    public function setApplication(Application $application = null)
137
-    {
132
+    public function setApplication(Application $application = null) {
138 133
         $this->application = $application;
139 134
         if ($application) {
140 135
             $this->setHelperSet($application->getHelperSet());
@@ -145,8 +140,7 @@  discard block
 block discarded – undo
145 140
         $this->fullDefinition = null;
146 141
     }
147 142
 
148
-    public function setHelperSet(HelperSet $helperSet)
149
-    {
143
+    public function setHelperSet(HelperSet $helperSet) {
150 144
         $this->helperSet = $helperSet;
151 145
     }
152 146
 
@@ -155,8 +149,7 @@  discard block
 block discarded – undo
155 149
      *
156 150
      * @return HelperSet|null A HelperSet instance
157 151
      */
158
-    public function getHelperSet()
159
-    {
152
+    public function getHelperSet() {
160 153
         return $this->helperSet;
161 154
     }
162 155
 
@@ -165,8 +158,7 @@  discard block
 block discarded – undo
165 158
      *
166 159
      * @return Application|null An Application instance
167 160
      */
168
-    public function getApplication()
169
-    {
161
+    public function getApplication() {
170 162
         return $this->application;
171 163
     }
172 164
 
@@ -178,16 +170,14 @@  discard block
 block discarded – undo
178 170
      *
179 171
      * @return bool
180 172
      */
181
-    public function isEnabled()
182
-    {
173
+    public function isEnabled() {
183 174
         return true;
184 175
     }
185 176
 
186 177
     /**
187 178
      * Configures the current command.
188 179
      */
189
-    protected function configure()
190
-    {
180
+    protected function configure() {
191 181
     }
192 182
 
193 183
     /**
@@ -204,8 +194,7 @@  discard block
 block discarded – undo
204 194
      *
205 195
      * @see setCode()
206 196
      */
207
-    protected function execute(InputInterface $input, OutputInterface $output)
208
-    {
197
+    protected function execute(InputInterface $input, OutputInterface $output) {
209 198
         throw new LogicException('You must override the execute() method in the concrete command class.');
210 199
     }
211 200
 
@@ -216,8 +205,7 @@  discard block
 block discarded – undo
216 205
      * This means that this is the only place where the command can
217 206
      * interactively ask for values of missing required arguments.
218 207
      */
219
-    protected function interact(InputInterface $input, OutputInterface $output)
220
-    {
208
+    protected function interact(InputInterface $input, OutputInterface $output) {
221 209
     }
222 210
 
223 211
     /**
@@ -230,8 +218,7 @@  discard block
 block discarded – undo
230 218
      * @see InputInterface::bind()
231 219
      * @see InputInterface::validate()
232 220
      */
233
-    protected function initialize(InputInterface $input, OutputInterface $output)
234
-    {
221
+    protected function initialize(InputInterface $input, OutputInterface $output) {
235 222
     }
236 223
 
237 224
     /**
@@ -248,8 +235,7 @@  discard block
 block discarded – undo
248 235
      * @see setCode()
249 236
      * @see execute()
250 237
      */
251
-    public function run(InputInterface $input, OutputInterface $output)
252
-    {
238
+    public function run(InputInterface $input, OutputInterface $output) {
253 239
         // add the application arguments and options
254 240
         $this->mergeApplicationDefinition();
255 241
 
@@ -320,8 +306,7 @@  discard block
 block discarded – undo
320 306
      *
321 307
      * @see execute()
322 308
      */
323
-    public function setCode(callable $code)
324
-    {
309
+    public function setCode(callable $code) {
325 310
         if ($code instanceof \Closure) {
326 311
             $r = new \ReflectionFunction($code);
327 312
             if (null === $r->getClosureThis()) {
@@ -350,8 +335,7 @@  discard block
 block discarded – undo
350 335
      *
351 336
      * @internal
352 337
      */
353
-    public function mergeApplicationDefinition(bool $mergeArgs = true)
354
-    {
338
+    public function mergeApplicationDefinition(bool $mergeArgs = true) {
355 339
         if (null === $this->application) {
356 340
             return;
357 341
         }
@@ -375,8 +359,7 @@  discard block
 block discarded – undo
375 359
      *
376 360
      * @return $this
377 361
      */
378
-    public function setDefinition($definition)
379
-    {
362
+    public function setDefinition($definition) {
380 363
         if ($definition instanceof InputDefinition) {
381 364
             $this->definition = $definition;
382 365
         } else {
@@ -393,8 +376,7 @@  discard block
 block discarded – undo
393 376
      *
394 377
      * @return InputDefinition An InputDefinition instance
395 378
      */
396
-    public function getDefinition()
397
-    {
379
+    public function getDefinition() {
398 380
         return $this->fullDefinition ?? $this->getNativeDefinition();
399 381
     }
400 382
 
@@ -408,8 +390,7 @@  discard block
 block discarded – undo
408 390
      *
409 391
      * @return InputDefinition An InputDefinition instance
410 392
      */
411
-    public function getNativeDefinition()
412
-    {
393
+    public function getNativeDefinition() {
413 394
         if (null === $this->definition) {
414 395
             throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
415 396
         }
@@ -427,8 +408,7 @@  discard block
 block discarded – undo
427 408
      *
428 409
      * @return $this
429 410
      */
430
-    public function addArgument(string $name, int $mode = null, string $description = '', $default = null)
431
-    {
411
+    public function addArgument(string $name, int $mode = null, string $description = '', $default = null) {
432 412
         $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
433 413
         if (null !== $this->fullDefinition) {
434 414
             $this->fullDefinition->addArgument(new InputArgument($name, $mode, $description, $default));
@@ -448,8 +428,7 @@  discard block
 block discarded – undo
448 428
      *
449 429
      * @return $this
450 430
      */
451
-    public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
452
-    {
431
+    public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null) {
453 432
         $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
454 433
         if (null !== $this->fullDefinition) {
455 434
             $this->fullDefinition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
@@ -470,8 +449,7 @@  discard block
 block discarded – undo
470 449
      *
471 450
      * @throws InvalidArgumentException When the name is invalid
472 451
      */
473
-    public function setName(string $name)
474
-    {
452
+    public function setName(string $name) {
475 453
         $this->validateName($name);
476 454
 
477 455
         $this->name = $name;
@@ -487,8 +465,7 @@  discard block
 block discarded – undo
487 465
      *
488 466
      * @return $this
489 467
      */
490
-    public function setProcessTitle(string $title)
491
-    {
468
+    public function setProcessTitle(string $title) {
492 469
         $this->processTitle = $title;
493 470
 
494 471
         return $this;
@@ -499,8 +476,7 @@  discard block
 block discarded – undo
499 476
      *
500 477
      * @return string|null
501 478
      */
502
-    public function getName()
503
-    {
479
+    public function getName() {
504 480
         return $this->name;
505 481
     }
506 482
 
@@ -512,8 +488,7 @@  discard block
 block discarded – undo
512 488
      *
513 489
      * @final since Symfony 5.1
514 490
      */
515
-    public function setHidden(bool $hidden /*= true*/)
516
-    {
491
+    public function setHidden(bool $hidden /*= true*/) {
517 492
         $this->hidden = $hidden;
518 493
 
519 494
         return $this;
@@ -522,8 +497,7 @@  discard block
 block discarded – undo
522 497
     /**
523 498
      * @return bool whether the command should be publicly shown or not
524 499
      */
525
-    public function isHidden()
526
-    {
500
+    public function isHidden() {
527 501
         return $this->hidden;
528 502
     }
529 503
 
@@ -532,8 +506,7 @@  discard block
 block discarded – undo
532 506
      *
533 507
      * @return $this
534 508
      */
535
-    public function setDescription(string $description)
536
-    {
509
+    public function setDescription(string $description) {
537 510
         $this->description = $description;
538 511
 
539 512
         return $this;
@@ -544,8 +517,7 @@  discard block
 block discarded – undo
544 517
      *
545 518
      * @return string The description for the command
546 519
      */
547
-    public function getDescription()
548
-    {
520
+    public function getDescription() {
549 521
         return $this->description;
550 522
     }
551 523
 
@@ -554,8 +526,7 @@  discard block
 block discarded – undo
554 526
      *
555 527
      * @return $this
556 528
      */
557
-    public function setHelp(string $help)
558
-    {
529
+    public function setHelp(string $help) {
559 530
         $this->help = $help;
560 531
 
561 532
         return $this;
@@ -566,8 +537,7 @@  discard block
 block discarded – undo
566 537
      *
567 538
      * @return string The help for the command
568 539
      */
569
-    public function getHelp()
570
-    {
540
+    public function getHelp() {
571 541
         return $this->help;
572 542
     }
573 543
 
@@ -577,8 +547,7 @@  discard block
 block discarded – undo
577 547
      *
578 548
      * @return string The processed help for the command
579 549
      */
580
-    public function getProcessedHelp()
581
-    {
550
+    public function getProcessedHelp() {
582 551
         $name = $this->name;
583 552
         $isSingleCommand = $this->application && $this->application->isSingleCommand();
584 553
 
@@ -603,8 +572,7 @@  discard block
 block discarded – undo
603 572
      *
604 573
      * @throws InvalidArgumentException When an alias is invalid
605 574
      */
606
-    public function setAliases(iterable $aliases)
607
-    {
575
+    public function setAliases(iterable $aliases) {
608 576
         $list = [];
609 577
 
610 578
         foreach ($aliases as $alias) {
@@ -622,8 +590,7 @@  discard block
 block discarded – undo
622 590
      *
623 591
      * @return array An array of aliases for the command
624 592
      */
625
-    public function getAliases()
626
-    {
593
+    public function getAliases() {
627 594
         return $this->aliases;
628 595
     }
629 596
 
@@ -634,8 +601,7 @@  discard block
 block discarded – undo
634 601
      *
635 602
      * @return string The synopsis
636 603
      */
637
-    public function getSynopsis(bool $short = false)
638
-    {
604
+    public function getSynopsis(bool $short = false) {
639 605
         $key = $short ? 'short' : 'long';
640 606
 
641 607
         if (!isset($this->synopsis[$key])) {
@@ -650,8 +616,7 @@  discard block
 block discarded – undo
650 616
      *
651 617
      * @return $this
652 618
      */
653
-    public function addUsage(string $usage)
654
-    {
619
+    public function addUsage(string $usage) {
655 620
         if (!str_starts_with($usage, $this->name)) {
656 621
             $usage = sprintf('%s %s', $this->name, $usage);
657 622
         }
@@ -666,8 +631,7 @@  discard block
 block discarded – undo
666 631
      *
667 632
      * @return array
668 633
      */
669
-    public function getUsages()
670
-    {
634
+    public function getUsages() {
671 635
         return $this->usages;
672 636
     }
673 637
 
@@ -679,8 +643,7 @@  discard block
 block discarded – undo
679 643
      * @throws LogicException           if no HelperSet is defined
680 644
      * @throws InvalidArgumentException if the helper is not defined
681 645
      */
682
-    public function getHelper(string $name)
683
-    {
646
+    public function getHelper(string $name) {
684 647
         if (null === $this->helperSet) {
685 648
             throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
686 649
         }
@@ -695,8 +658,7 @@  discard block
 block discarded – undo
695 658
      *
696 659
      * @throws InvalidArgumentException When the name is invalid
697 660
      */
698
-    private function validateName(string $name)
699
-    {
661
+    private function validateName(string $name) {
700 662
         if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
701 663
             throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
702 664
         }
Please login to merge, or discard this patch.
vendor/symfony/console/Output/BufferedOutput.php 3 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,30 +16,30 @@
 block discarded – undo
16 16
  */
17 17
 class BufferedOutput extends Output
18 18
 {
19
-    private $buffer = '';
19
+	private $buffer = '';
20 20
 
21
-    /**
22
-     * Empties buffer and returns its content.
23
-     *
24
-     * @return string
25
-     */
26
-    public function fetch()
27
-    {
28
-        $content = $this->buffer;
29
-        $this->buffer = '';
21
+	/**
22
+	 * Empties buffer and returns its content.
23
+	 *
24
+	 * @return string
25
+	 */
26
+	public function fetch()
27
+	{
28
+		$content = $this->buffer;
29
+		$this->buffer = '';
30 30
 
31
-        return $content;
32
-    }
31
+		return $content;
32
+	}
33 33
 
34
-    /**
35
-     * {@inheritdoc}
36
-     */
37
-    protected function doWrite(string $message, bool $newline)
38
-    {
39
-        $this->buffer .= $message;
34
+	/**
35
+	 * {@inheritdoc}
36
+	 */
37
+	protected function doWrite(string $message, bool $newline)
38
+	{
39
+		$this->buffer .= $message;
40 40
 
41
-        if ($newline) {
42
-            $this->buffer .= \PHP_EOL;
43
-        }
44
-    }
41
+		if ($newline) {
42
+			$this->buffer .= \PHP_EOL;
43
+		}
44
+	}
45 45
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@
 block discarded – undo
34 34
     /**
35 35
      * {@inheritdoc}
36 36
      */
37
-    protected function doWrite(string $message, bool $newline)
37
+    protected function doWrite( string $message, bool $newline )
38 38
     {
39 39
         $this->buffer .= $message;
40 40
 
41
-        if ($newline) {
41
+        if ( $newline ) {
42 42
             $this->buffer .= \PHP_EOL;
43 43
         }
44 44
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
 /**
15 15
  * @author Jean-François Simon <[email protected]>
16 16
  */
17
-class BufferedOutput extends Output
18
-{
17
+class BufferedOutput extends Output {
19 18
     private $buffer = '';
20 19
 
21 20
     /**
@@ -23,8 +22,7 @@  discard block
 block discarded – undo
23 22
      *
24 23
      * @return string
25 24
      */
26
-    public function fetch()
27
-    {
25
+    public function fetch() {
28 26
         $content = $this->buffer;
29 27
         $this->buffer = '';
30 28
 
@@ -34,8 +32,7 @@  discard block
 block discarded – undo
34 32
     /**
35 33
      * {@inheritdoc}
36 34
      */
37
-    protected function doWrite(string $message, bool $newline)
38
-    {
35
+    protected function doWrite(string $message, bool $newline) {
39 36
         $this->buffer .= $message;
40 37
 
41 38
         if ($newline) {
Please login to merge, or discard this patch.
vendor/symfony/console/Output/Output.php 3 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -29,146 +29,146 @@
 block discarded – undo
29 29
  */
30 30
 abstract class Output implements OutputInterface
31 31
 {
32
-    private $verbosity;
33
-    private $formatter;
34
-
35
-    /**
36
-     * @param int                           $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
37
-     * @param bool                          $decorated Whether to decorate messages
38
-     * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
39
-     */
40
-    public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
41
-    {
42
-        $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
43
-        $this->formatter = $formatter ?? new OutputFormatter();
44
-        $this->formatter->setDecorated($decorated);
45
-    }
46
-
47
-    /**
48
-     * {@inheritdoc}
49
-     */
50
-    public function setFormatter(OutputFormatterInterface $formatter)
51
-    {
52
-        $this->formatter = $formatter;
53
-    }
54
-
55
-    /**
56
-     * {@inheritdoc}
57
-     */
58
-    public function getFormatter()
59
-    {
60
-        return $this->formatter;
61
-    }
62
-
63
-    /**
64
-     * {@inheritdoc}
65
-     */
66
-    public function setDecorated(bool $decorated)
67
-    {
68
-        $this->formatter->setDecorated($decorated);
69
-    }
70
-
71
-    /**
72
-     * {@inheritdoc}
73
-     */
74
-    public function isDecorated()
75
-    {
76
-        return $this->formatter->isDecorated();
77
-    }
78
-
79
-    /**
80
-     * {@inheritdoc}
81
-     */
82
-    public function setVerbosity(int $level)
83
-    {
84
-        $this->verbosity = $level;
85
-    }
86
-
87
-    /**
88
-     * {@inheritdoc}
89
-     */
90
-    public function getVerbosity()
91
-    {
92
-        return $this->verbosity;
93
-    }
94
-
95
-    /**
96
-     * {@inheritdoc}
97
-     */
98
-    public function isQuiet()
99
-    {
100
-        return self::VERBOSITY_QUIET === $this->verbosity;
101
-    }
102
-
103
-    /**
104
-     * {@inheritdoc}
105
-     */
106
-    public function isVerbose()
107
-    {
108
-        return self::VERBOSITY_VERBOSE <= $this->verbosity;
109
-    }
110
-
111
-    /**
112
-     * {@inheritdoc}
113
-     */
114
-    public function isVeryVerbose()
115
-    {
116
-        return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
117
-    }
118
-
119
-    /**
120
-     * {@inheritdoc}
121
-     */
122
-    public function isDebug()
123
-    {
124
-        return self::VERBOSITY_DEBUG <= $this->verbosity;
125
-    }
126
-
127
-    /**
128
-     * {@inheritdoc}
129
-     */
130
-    public function writeln($messages, int $options = self::OUTPUT_NORMAL)
131
-    {
132
-        $this->write($messages, true, $options);
133
-    }
134
-
135
-    /**
136
-     * {@inheritdoc}
137
-     */
138
-    public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
139
-    {
140
-        if (!is_iterable($messages)) {
141
-            $messages = [$messages];
142
-        }
143
-
144
-        $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
145
-        $type = $types & $options ?: self::OUTPUT_NORMAL;
146
-
147
-        $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
148
-        $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
149
-
150
-        if ($verbosity > $this->getVerbosity()) {
151
-            return;
152
-        }
153
-
154
-        foreach ($messages as $message) {
155
-            switch ($type) {
156
-                case OutputInterface::OUTPUT_NORMAL:
157
-                    $message = $this->formatter->format($message);
158
-                    break;
159
-                case OutputInterface::OUTPUT_RAW:
160
-                    break;
161
-                case OutputInterface::OUTPUT_PLAIN:
162
-                    $message = strip_tags($this->formatter->format($message));
163
-                    break;
164
-            }
165
-
166
-            $this->doWrite($message ?? '', $newline);
167
-        }
168
-    }
169
-
170
-    /**
171
-     * Writes a message to the output.
172
-     */
173
-    abstract protected function doWrite(string $message, bool $newline);
32
+	private $verbosity;
33
+	private $formatter;
34
+
35
+	/**
36
+	 * @param int                           $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
37
+	 * @param bool                          $decorated Whether to decorate messages
38
+	 * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
39
+	 */
40
+	public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
41
+	{
42
+		$this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
43
+		$this->formatter = $formatter ?? new OutputFormatter();
44
+		$this->formatter->setDecorated($decorated);
45
+	}
46
+
47
+	/**
48
+	 * {@inheritdoc}
49
+	 */
50
+	public function setFormatter(OutputFormatterInterface $formatter)
51
+	{
52
+		$this->formatter = $formatter;
53
+	}
54
+
55
+	/**
56
+	 * {@inheritdoc}
57
+	 */
58
+	public function getFormatter()
59
+	{
60
+		return $this->formatter;
61
+	}
62
+
63
+	/**
64
+	 * {@inheritdoc}
65
+	 */
66
+	public function setDecorated(bool $decorated)
67
+	{
68
+		$this->formatter->setDecorated($decorated);
69
+	}
70
+
71
+	/**
72
+	 * {@inheritdoc}
73
+	 */
74
+	public function isDecorated()
75
+	{
76
+		return $this->formatter->isDecorated();
77
+	}
78
+
79
+	/**
80
+	 * {@inheritdoc}
81
+	 */
82
+	public function setVerbosity(int $level)
83
+	{
84
+		$this->verbosity = $level;
85
+	}
86
+
87
+	/**
88
+	 * {@inheritdoc}
89
+	 */
90
+	public function getVerbosity()
91
+	{
92
+		return $this->verbosity;
93
+	}
94
+
95
+	/**
96
+	 * {@inheritdoc}
97
+	 */
98
+	public function isQuiet()
99
+	{
100
+		return self::VERBOSITY_QUIET === $this->verbosity;
101
+	}
102
+
103
+	/**
104
+	 * {@inheritdoc}
105
+	 */
106
+	public function isVerbose()
107
+	{
108
+		return self::VERBOSITY_VERBOSE <= $this->verbosity;
109
+	}
110
+
111
+	/**
112
+	 * {@inheritdoc}
113
+	 */
114
+	public function isVeryVerbose()
115
+	{
116
+		return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
117
+	}
118
+
119
+	/**
120
+	 * {@inheritdoc}
121
+	 */
122
+	public function isDebug()
123
+	{
124
+		return self::VERBOSITY_DEBUG <= $this->verbosity;
125
+	}
126
+
127
+	/**
128
+	 * {@inheritdoc}
129
+	 */
130
+	public function writeln($messages, int $options = self::OUTPUT_NORMAL)
131
+	{
132
+		$this->write($messages, true, $options);
133
+	}
134
+
135
+	/**
136
+	 * {@inheritdoc}
137
+	 */
138
+	public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
139
+	{
140
+		if (!is_iterable($messages)) {
141
+			$messages = [$messages];
142
+		}
143
+
144
+		$types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
145
+		$type = $types & $options ?: self::OUTPUT_NORMAL;
146
+
147
+		$verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
148
+		$verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
149
+
150
+		if ($verbosity > $this->getVerbosity()) {
151
+			return;
152
+		}
153
+
154
+		foreach ($messages as $message) {
155
+			switch ($type) {
156
+				case OutputInterface::OUTPUT_NORMAL:
157
+					$message = $this->formatter->format($message);
158
+					break;
159
+				case OutputInterface::OUTPUT_RAW:
160
+					break;
161
+				case OutputInterface::OUTPUT_PLAIN:
162
+					$message = strip_tags($this->formatter->format($message));
163
+					break;
164
+			}
165
+
166
+			$this->doWrite($message ?? '', $newline);
167
+		}
168
+	}
169
+
170
+	/**
171
+	 * Writes a message to the output.
172
+	 */
173
+	abstract protected function doWrite(string $message, bool $newline);
174 174
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -37,17 +37,17 @@  discard block
 block discarded – undo
37 37
      * @param bool                          $decorated Whether to decorate messages
38 38
      * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
39 39
      */
40
-    public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
40
+    public function __construct( ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null )
41 41
     {
42 42
         $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
43 43
         $this->formatter = $formatter ?? new OutputFormatter();
44
-        $this->formatter->setDecorated($decorated);
44
+        $this->formatter->setDecorated( $decorated );
45 45
     }
46 46
 
47 47
     /**
48 48
      * {@inheritdoc}
49 49
      */
50
-    public function setFormatter(OutputFormatterInterface $formatter)
50
+    public function setFormatter( OutputFormatterInterface $formatter )
51 51
     {
52 52
         $this->formatter = $formatter;
53 53
     }
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
     /**
64 64
      * {@inheritdoc}
65 65
      */
66
-    public function setDecorated(bool $decorated)
66
+    public function setDecorated( bool $decorated )
67 67
     {
68
-        $this->formatter->setDecorated($decorated);
68
+        $this->formatter->setDecorated( $decorated );
69 69
     }
70 70
 
71 71
     /**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     /**
80 80
      * {@inheritdoc}
81 81
      */
82
-    public function setVerbosity(int $level)
82
+    public function setVerbosity( int $level )
83 83
     {
84 84
         $this->verbosity = $level;
85 85
     }
@@ -127,18 +127,18 @@  discard block
 block discarded – undo
127 127
     /**
128 128
      * {@inheritdoc}
129 129
      */
130
-    public function writeln($messages, int $options = self::OUTPUT_NORMAL)
130
+    public function writeln( $messages, int $options = self::OUTPUT_NORMAL )
131 131
     {
132
-        $this->write($messages, true, $options);
132
+        $this->write( $messages, true, $options );
133 133
     }
134 134
 
135 135
     /**
136 136
      * {@inheritdoc}
137 137
      */
138
-    public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
138
+    public function write( $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL )
139 139
     {
140
-        if (!is_iterable($messages)) {
141
-            $messages = [$messages];
140
+        if ( ! is_iterable( $messages ) ) {
141
+            $messages = [ $messages ];
142 142
         }
143 143
 
144 144
         $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
@@ -147,28 +147,28 @@  discard block
 block discarded – undo
147 147
         $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
148 148
         $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
149 149
 
150
-        if ($verbosity > $this->getVerbosity()) {
150
+        if ( $verbosity > $this->getVerbosity() ) {
151 151
             return;
152 152
         }
153 153
 
154
-        foreach ($messages as $message) {
155
-            switch ($type) {
154
+        foreach ( $messages as $message ) {
155
+            switch ( $type ) {
156 156
                 case OutputInterface::OUTPUT_NORMAL:
157
-                    $message = $this->formatter->format($message);
157
+                    $message = $this->formatter->format( $message );
158 158
                     break;
159 159
                 case OutputInterface::OUTPUT_RAW:
160 160
                     break;
161 161
                 case OutputInterface::OUTPUT_PLAIN:
162
-                    $message = strip_tags($this->formatter->format($message));
162
+                    $message = strip_tags( $this->formatter->format( $message ) );
163 163
                     break;
164 164
             }
165 165
 
166
-            $this->doWrite($message ?? '', $newline);
166
+            $this->doWrite( $message ?? '', $newline );
167 167
         }
168 168
     }
169 169
 
170 170
     /**
171 171
      * Writes a message to the output.
172 172
      */
173
-    abstract protected function doWrite(string $message, bool $newline);
173
+    abstract protected function doWrite( string $message, bool $newline );
174 174
 }
Please login to merge, or discard this patch.
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @author Fabien Potencier <[email protected]>
29 29
  */
30
-abstract class Output implements OutputInterface
31
-{
30
+abstract class Output implements OutputInterface {
32 31
     private $verbosity;
33 32
     private $formatter;
34 33
 
@@ -37,8 +36,7 @@  discard block
 block discarded – undo
37 36
      * @param bool                          $decorated Whether to decorate messages
38 37
      * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
39 38
      */
40
-    public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
41
-    {
39
+    public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null) {
42 40
         $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
43 41
         $this->formatter = $formatter ?? new OutputFormatter();
44 42
         $this->formatter->setDecorated($decorated);
@@ -47,96 +45,84 @@  discard block
 block discarded – undo
47 45
     /**
48 46
      * {@inheritdoc}
49 47
      */
50
-    public function setFormatter(OutputFormatterInterface $formatter)
51
-    {
48
+    public function setFormatter(OutputFormatterInterface $formatter) {
52 49
         $this->formatter = $formatter;
53 50
     }
54 51
 
55 52
     /**
56 53
      * {@inheritdoc}
57 54
      */
58
-    public function getFormatter()
59
-    {
55
+    public function getFormatter() {
60 56
         return $this->formatter;
61 57
     }
62 58
 
63 59
     /**
64 60
      * {@inheritdoc}
65 61
      */
66
-    public function setDecorated(bool $decorated)
67
-    {
62
+    public function setDecorated(bool $decorated) {
68 63
         $this->formatter->setDecorated($decorated);
69 64
     }
70 65
 
71 66
     /**
72 67
      * {@inheritdoc}
73 68
      */
74
-    public function isDecorated()
75
-    {
69
+    public function isDecorated() {
76 70
         return $this->formatter->isDecorated();
77 71
     }
78 72
 
79 73
     /**
80 74
      * {@inheritdoc}
81 75
      */
82
-    public function setVerbosity(int $level)
83
-    {
76
+    public function setVerbosity(int $level) {
84 77
         $this->verbosity = $level;
85 78
     }
86 79
 
87 80
     /**
88 81
      * {@inheritdoc}
89 82
      */
90
-    public function getVerbosity()
91
-    {
83
+    public function getVerbosity() {
92 84
         return $this->verbosity;
93 85
     }
94 86
 
95 87
     /**
96 88
      * {@inheritdoc}
97 89
      */
98
-    public function isQuiet()
99
-    {
90
+    public function isQuiet() {
100 91
         return self::VERBOSITY_QUIET === $this->verbosity;
101 92
     }
102 93
 
103 94
     /**
104 95
      * {@inheritdoc}
105 96
      */
106
-    public function isVerbose()
107
-    {
97
+    public function isVerbose() {
108 98
         return self::VERBOSITY_VERBOSE <= $this->verbosity;
109 99
     }
110 100
 
111 101
     /**
112 102
      * {@inheritdoc}
113 103
      */
114
-    public function isVeryVerbose()
115
-    {
104
+    public function isVeryVerbose() {
116 105
         return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
117 106
     }
118 107
 
119 108
     /**
120 109
      * {@inheritdoc}
121 110
      */
122
-    public function isDebug()
123
-    {
111
+    public function isDebug() {
124 112
         return self::VERBOSITY_DEBUG <= $this->verbosity;
125 113
     }
126 114
 
127 115
     /**
128 116
      * {@inheritdoc}
129 117
      */
130
-    public function writeln($messages, int $options = self::OUTPUT_NORMAL)
131
-    {
118
+    public function writeln($messages, int $options = self::OUTPUT_NORMAL) {
132 119
         $this->write($messages, true, $options);
133 120
     }
134 121
 
135 122
     /**
136 123
      * {@inheritdoc}
137 124
      */
138
-    public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
139
-    {
125
+    public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL) {
140 126
         if (!is_iterable($messages)) {
141 127
             $messages = [$messages];
142 128
         }
Please login to merge, or discard this patch.
vendor/symfony/console/Output/ConsoleOutputInterface.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@
 block discarded – undo
19 19
  */
20 20
 interface ConsoleOutputInterface extends OutputInterface
21 21
 {
22
-    /**
23
-     * Gets the OutputInterface for errors.
24
-     *
25
-     * @return OutputInterface
26
-     */
27
-    public function getErrorOutput();
22
+	/**
23
+	 * Gets the OutputInterface for errors.
24
+	 *
25
+	 * @return OutputInterface
26
+	 */
27
+	public function getErrorOutput();
28 28
 
29
-    public function setErrorOutput(OutputInterface $error);
29
+	public function setErrorOutput(OutputInterface $error);
30 30
 
31
-    public function section(): ConsoleSectionOutput;
31
+	public function section(): ConsoleSectionOutput;
32 32
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      */
27 27
     public function getErrorOutput();
28 28
 
29
-    public function setErrorOutput(OutputInterface $error);
29
+    public function setErrorOutput( OutputInterface $error );
30 30
 
31 31
     public function section(): ConsoleSectionOutput;
32 32
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
17 17
  *
18 18
  * @author Dariusz Górecki <[email protected]>
19 19
  */
20
-interface ConsoleOutputInterface extends OutputInterface
21
-{
20
+interface ConsoleOutputInterface extends OutputInterface {
22 21
     /**
23 22
      * Gets the OutputInterface for errors.
24 23
      *
Please login to merge, or discard this patch.
vendor/symfony/console/Output/ConsoleOutput.php 3 patches
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -29,138 +29,138 @@
 block discarded – undo
29 29
  */
30 30
 class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
31 31
 {
32
-    private $stderr;
33
-    private $consoleSectionOutputs = [];
34
-
35
-    /**
36
-     * @param int                           $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
37
-     * @param bool|null                     $decorated Whether to decorate messages (null for auto-guessing)
38
-     * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
39
-     */
40
-    public function __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
41
-    {
42
-        parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
43
-
44
-        if (null === $formatter) {
45
-            // for BC reasons, stdErr has it own Formatter only when user don't inject a specific formatter.
46
-            $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated);
47
-
48
-            return;
49
-        }
50
-
51
-        $actualDecorated = $this->isDecorated();
52
-        $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
53
-
54
-        if (null === $decorated) {
55
-            $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
56
-        }
57
-    }
58
-
59
-    /**
60
-     * Creates a new output section.
61
-     */
62
-    public function section(): ConsoleSectionOutput
63
-    {
64
-        return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
65
-    }
66
-
67
-    /**
68
-     * {@inheritdoc}
69
-     */
70
-    public function setDecorated(bool $decorated)
71
-    {
72
-        parent::setDecorated($decorated);
73
-        $this->stderr->setDecorated($decorated);
74
-    }
75
-
76
-    /**
77
-     * {@inheritdoc}
78
-     */
79
-    public function setFormatter(OutputFormatterInterface $formatter)
80
-    {
81
-        parent::setFormatter($formatter);
82
-        $this->stderr->setFormatter($formatter);
83
-    }
84
-
85
-    /**
86
-     * {@inheritdoc}
87
-     */
88
-    public function setVerbosity(int $level)
89
-    {
90
-        parent::setVerbosity($level);
91
-        $this->stderr->setVerbosity($level);
92
-    }
93
-
94
-    /**
95
-     * {@inheritdoc}
96
-     */
97
-    public function getErrorOutput()
98
-    {
99
-        return $this->stderr;
100
-    }
101
-
102
-    /**
103
-     * {@inheritdoc}
104
-     */
105
-    public function setErrorOutput(OutputInterface $error)
106
-    {
107
-        $this->stderr = $error;
108
-    }
109
-
110
-    /**
111
-     * Returns true if current environment supports writing console output to
112
-     * STDOUT.
113
-     *
114
-     * @return bool
115
-     */
116
-    protected function hasStdoutSupport()
117
-    {
118
-        return false === $this->isRunningOS400();
119
-    }
120
-
121
-    /**
122
-     * Returns true if current environment supports writing console output to
123
-     * STDERR.
124
-     *
125
-     * @return bool
126
-     */
127
-    protected function hasStderrSupport()
128
-    {
129
-        return false === $this->isRunningOS400();
130
-    }
131
-
132
-    /**
133
-     * Checks if current executing environment is IBM iSeries (OS400), which
134
-     * doesn't properly convert character-encodings between ASCII to EBCDIC.
135
-     */
136
-    private function isRunningOS400(): bool
137
-    {
138
-        $checks = [
139
-            \function_exists('php_uname') ? php_uname('s') : '',
140
-            getenv('OSTYPE'),
141
-            \PHP_OS,
142
-        ];
143
-
144
-        return false !== stripos(implode(';', $checks), 'OS400');
145
-    }
146
-
147
-    /**
148
-     * @return resource
149
-     */
150
-    private function openOutputStream()
151
-    {
152
-        if (!$this->hasStdoutSupport()) {
153
-            return fopen('php://output', 'w');
154
-        }
155
-
156
-        return @fopen('php://stdout', 'w') ?: fopen('php://output', 'w');
157
-    }
158
-
159
-    /**
160
-     * @return resource
161
-     */
162
-    private function openErrorStream()
163
-    {
164
-        return fopen($this->hasStderrSupport() ? 'php://stderr' : 'php://output', 'w');
165
-    }
32
+	private $stderr;
33
+	private $consoleSectionOutputs = [];
34
+
35
+	/**
36
+	 * @param int                           $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
37
+	 * @param bool|null                     $decorated Whether to decorate messages (null for auto-guessing)
38
+	 * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
39
+	 */
40
+	public function __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
41
+	{
42
+		parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
43
+
44
+		if (null === $formatter) {
45
+			// for BC reasons, stdErr has it own Formatter only when user don't inject a specific formatter.
46
+			$this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated);
47
+
48
+			return;
49
+		}
50
+
51
+		$actualDecorated = $this->isDecorated();
52
+		$this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
53
+
54
+		if (null === $decorated) {
55
+			$this->setDecorated($actualDecorated && $this->stderr->isDecorated());
56
+		}
57
+	}
58
+
59
+	/**
60
+	 * Creates a new output section.
61
+	 */
62
+	public function section(): ConsoleSectionOutput
63
+	{
64
+		return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
65
+	}
66
+
67
+	/**
68
+	 * {@inheritdoc}
69
+	 */
70
+	public function setDecorated(bool $decorated)
71
+	{
72
+		parent::setDecorated($decorated);
73
+		$this->stderr->setDecorated($decorated);
74
+	}
75
+
76
+	/**
77
+	 * {@inheritdoc}
78
+	 */
79
+	public function setFormatter(OutputFormatterInterface $formatter)
80
+	{
81
+		parent::setFormatter($formatter);
82
+		$this->stderr->setFormatter($formatter);
83
+	}
84
+
85
+	/**
86
+	 * {@inheritdoc}
87
+	 */
88
+	public function setVerbosity(int $level)
89
+	{
90
+		parent::setVerbosity($level);
91
+		$this->stderr->setVerbosity($level);
92
+	}
93
+
94
+	/**
95
+	 * {@inheritdoc}
96
+	 */
97
+	public function getErrorOutput()
98
+	{
99
+		return $this->stderr;
100
+	}
101
+
102
+	/**
103
+	 * {@inheritdoc}
104
+	 */
105
+	public function setErrorOutput(OutputInterface $error)
106
+	{
107
+		$this->stderr = $error;
108
+	}
109
+
110
+	/**
111
+	 * Returns true if current environment supports writing console output to
112
+	 * STDOUT.
113
+	 *
114
+	 * @return bool
115
+	 */
116
+	protected function hasStdoutSupport()
117
+	{
118
+		return false === $this->isRunningOS400();
119
+	}
120
+
121
+	/**
122
+	 * Returns true if current environment supports writing console output to
123
+	 * STDERR.
124
+	 *
125
+	 * @return bool
126
+	 */
127
+	protected function hasStderrSupport()
128
+	{
129
+		return false === $this->isRunningOS400();
130
+	}
131
+
132
+	/**
133
+	 * Checks if current executing environment is IBM iSeries (OS400), which
134
+	 * doesn't properly convert character-encodings between ASCII to EBCDIC.
135
+	 */
136
+	private function isRunningOS400(): bool
137
+	{
138
+		$checks = [
139
+			\function_exists('php_uname') ? php_uname('s') : '',
140
+			getenv('OSTYPE'),
141
+			\PHP_OS,
142
+		];
143
+
144
+		return false !== stripos(implode(';', $checks), 'OS400');
145
+	}
146
+
147
+	/**
148
+	 * @return resource
149
+	 */
150
+	private function openOutputStream()
151
+	{
152
+		if (!$this->hasStdoutSupport()) {
153
+			return fopen('php://output', 'w');
154
+		}
155
+
156
+		return @fopen('php://stdout', 'w') ?: fopen('php://output', 'w');
157
+	}
158
+
159
+	/**
160
+	 * @return resource
161
+	 */
162
+	private function openErrorStream()
163
+	{
164
+		return fopen($this->hasStderrSupport() ? 'php://stderr' : 'php://output', 'w');
165
+	}
166 166
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -30,29 +30,29 @@  discard block
 block discarded – undo
30 30
 class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
31 31
 {
32 32
     private $stderr;
33
-    private $consoleSectionOutputs = [];
33
+    private $consoleSectionOutputs = [ ];
34 34
 
35 35
     /**
36 36
      * @param int                           $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
37 37
      * @param bool|null                     $decorated Whether to decorate messages (null for auto-guessing)
38 38
      * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
39 39
      */
40
-    public function __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
40
+    public function __construct( int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null )
41 41
     {
42
-        parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
42
+        parent::__construct( $this->openOutputStream(), $verbosity, $decorated, $formatter );
43 43
 
44
-        if (null === $formatter) {
44
+        if ( null === $formatter ) {
45 45
             // for BC reasons, stdErr has it own Formatter only when user don't inject a specific formatter.
46
-            $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated);
46
+            $this->stderr = new StreamOutput( $this->openErrorStream(), $verbosity, $decorated );
47 47
 
48 48
             return;
49 49
         }
50 50
 
51 51
         $actualDecorated = $this->isDecorated();
52
-        $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
52
+        $this->stderr = new StreamOutput( $this->openErrorStream(), $verbosity, $decorated, $this->getFormatter() );
53 53
 
54
-        if (null === $decorated) {
55
-            $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
54
+        if ( null === $decorated ) {
55
+            $this->setDecorated( $actualDecorated && $this->stderr->isDecorated() );
56 56
         }
57 57
     }
58 58
 
@@ -61,34 +61,34 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function section(): ConsoleSectionOutput
63 63
     {
64
-        return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
64
+        return new ConsoleSectionOutput( $this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter() );
65 65
     }
66 66
 
67 67
     /**
68 68
      * {@inheritdoc}
69 69
      */
70
-    public function setDecorated(bool $decorated)
70
+    public function setDecorated( bool $decorated )
71 71
     {
72
-        parent::setDecorated($decorated);
73
-        $this->stderr->setDecorated($decorated);
72
+        parent::setDecorated( $decorated );
73
+        $this->stderr->setDecorated( $decorated );
74 74
     }
75 75
 
76 76
     /**
77 77
      * {@inheritdoc}
78 78
      */
79
-    public function setFormatter(OutputFormatterInterface $formatter)
79
+    public function setFormatter( OutputFormatterInterface $formatter )
80 80
     {
81
-        parent::setFormatter($formatter);
82
-        $this->stderr->setFormatter($formatter);
81
+        parent::setFormatter( $formatter );
82
+        $this->stderr->setFormatter( $formatter );
83 83
     }
84 84
 
85 85
     /**
86 86
      * {@inheritdoc}
87 87
      */
88
-    public function setVerbosity(int $level)
88
+    public function setVerbosity( int $level )
89 89
     {
90
-        parent::setVerbosity($level);
91
-        $this->stderr->setVerbosity($level);
90
+        parent::setVerbosity( $level );
91
+        $this->stderr->setVerbosity( $level );
92 92
     }
93 93
 
94 94
     /**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     /**
103 103
      * {@inheritdoc}
104 104
      */
105
-    public function setErrorOutput(OutputInterface $error)
105
+    public function setErrorOutput( OutputInterface $error )
106 106
     {
107 107
         $this->stderr = $error;
108 108
     }
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
     private function isRunningOS400(): bool
137 137
     {
138 138
         $checks = [
139
-            \function_exists('php_uname') ? php_uname('s') : '',
140
-            getenv('OSTYPE'),
139
+            \function_exists( 'php_uname' ) ? php_uname( 's' ) : '',
140
+            getenv( 'OSTYPE' ),
141 141
             \PHP_OS,
142 142
         ];
143 143
 
144
-        return false !== stripos(implode(';', $checks), 'OS400');
144
+        return false !== stripos( implode( ';', $checks ), 'OS400' );
145 145
     }
146 146
 
147 147
     /**
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
      */
150 150
     private function openOutputStream()
151 151
     {
152
-        if (!$this->hasStdoutSupport()) {
153
-            return fopen('php://output', 'w');
152
+        if ( ! $this->hasStdoutSupport() ) {
153
+            return fopen( 'php://output', 'w' );
154 154
         }
155 155
 
156
-        return @fopen('php://stdout', 'w') ?: fopen('php://output', 'w');
156
+        return @fopen( 'php://stdout', 'w' ) ?: fopen( 'php://output', 'w' );
157 157
     }
158 158
 
159 159
     /**
@@ -161,6 +161,6 @@  discard block
 block discarded – undo
161 161
      */
162 162
     private function openErrorStream()
163 163
     {
164
-        return fopen($this->hasStderrSupport() ? 'php://stderr' : 'php://output', 'w');
164
+        return fopen( $this->hasStderrSupport() ? 'php://stderr' : 'php://output', 'w' );
165 165
     }
166 166
 }
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @author Fabien Potencier <[email protected]>
29 29
  */
30
-class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
31
-{
30
+class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface {
32 31
     private $stderr;
33 32
     private $consoleSectionOutputs = [];
34 33
 
@@ -37,8 +36,7 @@  discard block
 block discarded – undo
37 36
      * @param bool|null                     $decorated Whether to decorate messages (null for auto-guessing)
38 37
      * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
39 38
      */
40
-    public function __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
41
-    {
39
+    public function __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null) {
42 40
         parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
43 41
 
44 42
         if (null === $formatter) {
@@ -67,8 +65,7 @@  discard block
 block discarded – undo
67 65
     /**
68 66
      * {@inheritdoc}
69 67
      */
70
-    public function setDecorated(bool $decorated)
71
-    {
68
+    public function setDecorated(bool $decorated) {
72 69
         parent::setDecorated($decorated);
73 70
         $this->stderr->setDecorated($decorated);
74 71
     }
@@ -76,8 +73,7 @@  discard block
 block discarded – undo
76 73
     /**
77 74
      * {@inheritdoc}
78 75
      */
79
-    public function setFormatter(OutputFormatterInterface $formatter)
80
-    {
76
+    public function setFormatter(OutputFormatterInterface $formatter) {
81 77
         parent::setFormatter($formatter);
82 78
         $this->stderr->setFormatter($formatter);
83 79
     }
@@ -85,8 +81,7 @@  discard block
 block discarded – undo
85 81
     /**
86 82
      * {@inheritdoc}
87 83
      */
88
-    public function setVerbosity(int $level)
89
-    {
84
+    public function setVerbosity(int $level) {
90 85
         parent::setVerbosity($level);
91 86
         $this->stderr->setVerbosity($level);
92 87
     }
@@ -94,16 +89,14 @@  discard block
 block discarded – undo
94 89
     /**
95 90
      * {@inheritdoc}
96 91
      */
97
-    public function getErrorOutput()
98
-    {
92
+    public function getErrorOutput() {
99 93
         return $this->stderr;
100 94
     }
101 95
 
102 96
     /**
103 97
      * {@inheritdoc}
104 98
      */
105
-    public function setErrorOutput(OutputInterface $error)
106
-    {
99
+    public function setErrorOutput(OutputInterface $error) {
107 100
         $this->stderr = $error;
108 101
     }
109 102
 
@@ -113,8 +106,7 @@  discard block
 block discarded – undo
113 106
      *
114 107
      * @return bool
115 108
      */
116
-    protected function hasStdoutSupport()
117
-    {
109
+    protected function hasStdoutSupport() {
118 110
         return false === $this->isRunningOS400();
119 111
     }
120 112
 
@@ -124,8 +116,7 @@  discard block
 block discarded – undo
124 116
      *
125 117
      * @return bool
126 118
      */
127
-    protected function hasStderrSupport()
128
-    {
119
+    protected function hasStderrSupport() {
129 120
         return false === $this->isRunningOS400();
130 121
     }
131 122
 
@@ -147,8 +138,7 @@  discard block
 block discarded – undo
147 138
     /**
148 139
      * @return resource
149 140
      */
150
-    private function openOutputStream()
151
-    {
141
+    private function openOutputStream() {
152 142
         if (!$this->hasStdoutSupport()) {
153 143
             return fopen('php://output', 'w');
154 144
         }
@@ -159,8 +149,7 @@  discard block
 block discarded – undo
159 149
     /**
160 150
      * @return resource
161 151
      */
162
-    private function openErrorStream()
163
-    {
152
+    private function openErrorStream() {
164 153
         return fopen($this->hasStderrSupport() ? 'php://stderr' : 'php://output', 'w');
165 154
     }
166 155
 }
Please login to merge, or discard this patch.
vendor/symfony/console/Output/OutputInterface.php 3 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -20,91 +20,91 @@
 block discarded – undo
20 20
  */
21 21
 interface OutputInterface
22 22
 {
23
-    public const VERBOSITY_QUIET = 16;
24
-    public const VERBOSITY_NORMAL = 32;
25
-    public const VERBOSITY_VERBOSE = 64;
26
-    public const VERBOSITY_VERY_VERBOSE = 128;
27
-    public const VERBOSITY_DEBUG = 256;
28
-
29
-    public const OUTPUT_NORMAL = 1;
30
-    public const OUTPUT_RAW = 2;
31
-    public const OUTPUT_PLAIN = 4;
32
-
33
-    /**
34
-     * Writes a message to the output.
35
-     *
36
-     * @param string|iterable $messages The message as an iterable of strings or a single string
37
-     * @param bool            $newline  Whether to add a newline
38
-     * @param int             $options  A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
39
-     */
40
-    public function write($messages, bool $newline = false, int $options = 0);
41
-
42
-    /**
43
-     * Writes a message to the output and adds a newline at the end.
44
-     *
45
-     * @param string|iterable $messages The message as an iterable of strings or a single string
46
-     * @param int             $options  A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
47
-     */
48
-    public function writeln($messages, int $options = 0);
49
-
50
-    /**
51
-     * Sets the verbosity of the output.
52
-     */
53
-    public function setVerbosity(int $level);
54
-
55
-    /**
56
-     * Gets the current verbosity of the output.
57
-     *
58
-     * @return int The current level of verbosity (one of the VERBOSITY constants)
59
-     */
60
-    public function getVerbosity();
61
-
62
-    /**
63
-     * Returns whether verbosity is quiet (-q).
64
-     *
65
-     * @return bool true if verbosity is set to VERBOSITY_QUIET, false otherwise
66
-     */
67
-    public function isQuiet();
68
-
69
-    /**
70
-     * Returns whether verbosity is verbose (-v).
71
-     *
72
-     * @return bool true if verbosity is set to VERBOSITY_VERBOSE, false otherwise
73
-     */
74
-    public function isVerbose();
75
-
76
-    /**
77
-     * Returns whether verbosity is very verbose (-vv).
78
-     *
79
-     * @return bool true if verbosity is set to VERBOSITY_VERY_VERBOSE, false otherwise
80
-     */
81
-    public function isVeryVerbose();
82
-
83
-    /**
84
-     * Returns whether verbosity is debug (-vvv).
85
-     *
86
-     * @return bool true if verbosity is set to VERBOSITY_DEBUG, false otherwise
87
-     */
88
-    public function isDebug();
89
-
90
-    /**
91
-     * Sets the decorated flag.
92
-     */
93
-    public function setDecorated(bool $decorated);
94
-
95
-    /**
96
-     * Gets the decorated flag.
97
-     *
98
-     * @return bool true if the output will decorate messages, false otherwise
99
-     */
100
-    public function isDecorated();
101
-
102
-    public function setFormatter(OutputFormatterInterface $formatter);
103
-
104
-    /**
105
-     * Returns current output formatter instance.
106
-     *
107
-     * @return OutputFormatterInterface
108
-     */
109
-    public function getFormatter();
23
+	public const VERBOSITY_QUIET = 16;
24
+	public const VERBOSITY_NORMAL = 32;
25
+	public const VERBOSITY_VERBOSE = 64;
26
+	public const VERBOSITY_VERY_VERBOSE = 128;
27
+	public const VERBOSITY_DEBUG = 256;
28
+
29
+	public const OUTPUT_NORMAL = 1;
30
+	public const OUTPUT_RAW = 2;
31
+	public const OUTPUT_PLAIN = 4;
32
+
33
+	/**
34
+	 * Writes a message to the output.
35
+	 *
36
+	 * @param string|iterable $messages The message as an iterable of strings or a single string
37
+	 * @param bool            $newline  Whether to add a newline
38
+	 * @param int             $options  A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
39
+	 */
40
+	public function write($messages, bool $newline = false, int $options = 0);
41
+
42
+	/**
43
+	 * Writes a message to the output and adds a newline at the end.
44
+	 *
45
+	 * @param string|iterable $messages The message as an iterable of strings or a single string
46
+	 * @param int             $options  A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
47
+	 */
48
+	public function writeln($messages, int $options = 0);
49
+
50
+	/**
51
+	 * Sets the verbosity of the output.
52
+	 */
53
+	public function setVerbosity(int $level);
54
+
55
+	/**
56
+	 * Gets the current verbosity of the output.
57
+	 *
58
+	 * @return int The current level of verbosity (one of the VERBOSITY constants)
59
+	 */
60
+	public function getVerbosity();
61
+
62
+	/**
63
+	 * Returns whether verbosity is quiet (-q).
64
+	 *
65
+	 * @return bool true if verbosity is set to VERBOSITY_QUIET, false otherwise
66
+	 */
67
+	public function isQuiet();
68
+
69
+	/**
70
+	 * Returns whether verbosity is verbose (-v).
71
+	 *
72
+	 * @return bool true if verbosity is set to VERBOSITY_VERBOSE, false otherwise
73
+	 */
74
+	public function isVerbose();
75
+
76
+	/**
77
+	 * Returns whether verbosity is very verbose (-vv).
78
+	 *
79
+	 * @return bool true if verbosity is set to VERBOSITY_VERY_VERBOSE, false otherwise
80
+	 */
81
+	public function isVeryVerbose();
82
+
83
+	/**
84
+	 * Returns whether verbosity is debug (-vvv).
85
+	 *
86
+	 * @return bool true if verbosity is set to VERBOSITY_DEBUG, false otherwise
87
+	 */
88
+	public function isDebug();
89
+
90
+	/**
91
+	 * Sets the decorated flag.
92
+	 */
93
+	public function setDecorated(bool $decorated);
94
+
95
+	/**
96
+	 * Gets the decorated flag.
97
+	 *
98
+	 * @return bool true if the output will decorate messages, false otherwise
99
+	 */
100
+	public function isDecorated();
101
+
102
+	public function setFormatter(OutputFormatterInterface $formatter);
103
+
104
+	/**
105
+	 * Returns current output formatter instance.
106
+	 *
107
+	 * @return OutputFormatterInterface
108
+	 */
109
+	public function getFormatter();
110 110
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param bool            $newline  Whether to add a newline
38 38
      * @param int             $options  A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
39 39
      */
40
-    public function write($messages, bool $newline = false, int $options = 0);
40
+    public function write( $messages, bool $newline = false, int $options = 0 );
41 41
 
42 42
     /**
43 43
      * Writes a message to the output and adds a newline at the end.
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
      * @param string|iterable $messages The message as an iterable of strings or a single string
46 46
      * @param int             $options  A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
47 47
      */
48
-    public function writeln($messages, int $options = 0);
48
+    public function writeln( $messages, int $options = 0 );
49 49
 
50 50
     /**
51 51
      * Sets the verbosity of the output.
52 52
      */
53
-    public function setVerbosity(int $level);
53
+    public function setVerbosity( int $level );
54 54
 
55 55
     /**
56 56
      * Gets the current verbosity of the output.
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     /**
91 91
      * Sets the decorated flag.
92 92
      */
93
-    public function setDecorated(bool $decorated);
93
+    public function setDecorated( bool $decorated );
94 94
 
95 95
     /**
96 96
      * Gets the decorated flag.
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function isDecorated();
101 101
 
102
-    public function setFormatter(OutputFormatterInterface $formatter);
102
+    public function setFormatter( OutputFormatterInterface $formatter );
103 103
 
104 104
     /**
105 105
      * Returns current output formatter instance.
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@
 block discarded – undo
18 18
  *
19 19
  * @author Fabien Potencier <[email protected]>
20 20
  */
21
-interface OutputInterface
22
-{
21
+interface OutputInterface {
23 22
     public const VERBOSITY_QUIET = 16;
24 23
     public const VERBOSITY_NORMAL = 32;
25 24
     public const VERBOSITY_VERBOSE = 64;
Please login to merge, or discard this patch.