@@ -28,79 +28,79 @@ |
||
28 | 28 | /** |
29 | 29 | * {@inheritdoc} |
30 | 30 | */ |
31 | - protected function writePrompt(OutputInterface $output, Question $question) |
|
31 | + protected function writePrompt( OutputInterface $output, Question $question ) |
|
32 | 32 | { |
33 | - $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion()); |
|
33 | + $text = OutputFormatter::escapeTrailingBackslash( $question->getQuestion() ); |
|
34 | 34 | $default = $question->getDefault(); |
35 | 35 | |
36 | - if ($question->isMultiline()) { |
|
37 | - $text .= sprintf(' (press %s to continue)', $this->getEofShortcut()); |
|
36 | + if ( $question->isMultiline() ) { |
|
37 | + $text .= sprintf( ' (press %s to continue)', $this->getEofShortcut() ); |
|
38 | 38 | } |
39 | 39 | |
40 | - switch (true) { |
|
40 | + switch ( true ) { |
|
41 | 41 | case null === $default: |
42 | - $text = sprintf(' <info>%s</info>:', $text); |
|
42 | + $text = sprintf( ' <info>%s</info>:', $text ); |
|
43 | 43 | |
44 | 44 | break; |
45 | 45 | |
46 | 46 | case $question instanceof ConfirmationQuestion: |
47 | - $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no'); |
|
47 | + $text = sprintf( ' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no' ); |
|
48 | 48 | |
49 | 49 | break; |
50 | 50 | |
51 | 51 | case $question instanceof ChoiceQuestion && $question->isMultiselect(): |
52 | 52 | $choices = $question->getChoices(); |
53 | - $default = explode(',', $default); |
|
53 | + $default = explode( ',', $default ); |
|
54 | 54 | |
55 | - foreach ($default as $key => $value) { |
|
56 | - $default[$key] = $choices[trim($value)]; |
|
55 | + foreach ( $default as $key => $value ) { |
|
56 | + $default[ $key ] = $choices[ trim( $value ) ]; |
|
57 | 57 | } |
58 | 58 | |
59 | - $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default))); |
|
59 | + $text = sprintf( ' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape( implode( ', ', $default ) ) ); |
|
60 | 60 | |
61 | 61 | break; |
62 | 62 | |
63 | 63 | case $question instanceof ChoiceQuestion: |
64 | 64 | $choices = $question->getChoices(); |
65 | - $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default] ?? $default)); |
|
65 | + $text = sprintf( ' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape( $choices[ $default ] ?? $default ) ); |
|
66 | 66 | |
67 | 67 | break; |
68 | 68 | |
69 | 69 | default: |
70 | - $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default)); |
|
70 | + $text = sprintf( ' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape( $default ) ); |
|
71 | 71 | } |
72 | 72 | |
73 | - $output->writeln($text); |
|
73 | + $output->writeln( $text ); |
|
74 | 74 | |
75 | 75 | $prompt = ' > '; |
76 | 76 | |
77 | - if ($question instanceof ChoiceQuestion) { |
|
78 | - $output->writeln($this->formatChoiceQuestionChoices($question, 'comment')); |
|
77 | + if ( $question instanceof ChoiceQuestion ) { |
|
78 | + $output->writeln( $this->formatChoiceQuestionChoices( $question, 'comment' ) ); |
|
79 | 79 | |
80 | 80 | $prompt = $question->getPrompt(); |
81 | 81 | } |
82 | 82 | |
83 | - $output->write($prompt); |
|
83 | + $output->write( $prompt ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | 87 | * {@inheritdoc} |
88 | 88 | */ |
89 | - protected function writeError(OutputInterface $output, \Exception $error) |
|
89 | + protected function writeError( OutputInterface $output, \Exception $error ) |
|
90 | 90 | { |
91 | - if ($output instanceof SymfonyStyle) { |
|
91 | + if ( $output instanceof SymfonyStyle ) { |
|
92 | 92 | $output->newLine(); |
93 | - $output->error($error->getMessage()); |
|
93 | + $output->error( $error->getMessage() ); |
|
94 | 94 | |
95 | 95 | return; |
96 | 96 | } |
97 | 97 | |
98 | - parent::writeError($output, $error); |
|
98 | + parent::writeError( $output, $error ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | private function getEofShortcut(): string |
102 | 102 | { |
103 | - if ('Windows' === \PHP_OS_FAMILY) { |
|
103 | + if ( 'Windows' === \PHP_OS_FAMILY ) { |
|
104 | 104 | return '<comment>Ctrl+Z</comment> then <comment>Enter</comment>'; |
105 | 105 | } |
106 | 106 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | private $generator; |
20 | 20 | |
21 | - public function __construct(callable $generator) |
|
21 | + public function __construct( callable $generator ) |
|
22 | 22 | { |
23 | 23 | $this->generator = $generator; |
24 | 24 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | private $stepWidth; |
55 | 55 | private $percent = 0.0; |
56 | 56 | private $formatLineCount; |
57 | - private $messages = []; |
|
57 | + private $messages = [ ]; |
|
58 | 58 | private $overwrite = true; |
59 | 59 | private $terminal; |
60 | 60 | private $previousMessage; |
@@ -66,22 +66,22 @@ discard block |
||
66 | 66 | /** |
67 | 67 | * @param int $max Maximum steps (0 if unknown) |
68 | 68 | */ |
69 | - public function __construct(OutputInterface $output, int $max = 0, float $minSecondsBetweenRedraws = 1 / 25) |
|
69 | + public function __construct( OutputInterface $output, int $max = 0, float $minSecondsBetweenRedraws = 1 / 25 ) |
|
70 | 70 | { |
71 | - if ($output instanceof ConsoleOutputInterface) { |
|
71 | + if ( $output instanceof ConsoleOutputInterface ) { |
|
72 | 72 | $output = $output->getErrorOutput(); |
73 | 73 | } |
74 | 74 | |
75 | 75 | $this->output = $output; |
76 | - $this->setMaxSteps($max); |
|
76 | + $this->setMaxSteps( $max ); |
|
77 | 77 | $this->terminal = new Terminal(); |
78 | 78 | |
79 | - if (0 < $minSecondsBetweenRedraws) { |
|
79 | + if ( 0 < $minSecondsBetweenRedraws ) { |
|
80 | 80 | $this->redrawFreq = null; |
81 | 81 | $this->minSecondsBetweenRedraws = $minSecondsBetweenRedraws; |
82 | 82 | } |
83 | 83 | |
84 | - if (!$this->output->isDecorated()) { |
|
84 | + if ( ! $this->output->isDecorated() ) { |
|
85 | 85 | // disable overwrite when output does not support ANSI codes. |
86 | 86 | $this->overwrite = false; |
87 | 87 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | $this->startTime = time(); |
93 | - $this->cursor = new Cursor($output); |
|
93 | + $this->cursor = new Cursor( $output ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | * @param string $name The placeholder name (including the delimiter char like %) |
102 | 102 | * @param callable $callable A PHP callable |
103 | 103 | */ |
104 | - public static function setPlaceholderFormatterDefinition(string $name, callable $callable): void |
|
104 | + public static function setPlaceholderFormatterDefinition( string $name, callable $callable ): void |
|
105 | 105 | { |
106 | - if (!self::$formatters) { |
|
106 | + if ( ! self::$formatters ) { |
|
107 | 107 | self::$formatters = self::initPlaceholderFormatters(); |
108 | 108 | } |
109 | 109 | |
110 | - self::$formatters[$name] = $callable; |
|
110 | + self::$formatters[ $name ] = $callable; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @return callable|null A PHP callable |
119 | 119 | */ |
120 | - public static function getPlaceholderFormatterDefinition(string $name): ?callable |
|
120 | + public static function getPlaceholderFormatterDefinition( string $name ): ?callable |
|
121 | 121 | { |
122 | - if (!self::$formatters) { |
|
122 | + if ( ! self::$formatters ) { |
|
123 | 123 | self::$formatters = self::initPlaceholderFormatters(); |
124 | 124 | } |
125 | 125 | |
126 | - return self::$formatters[$name] ?? null; |
|
126 | + return self::$formatters[ $name ] ?? null; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | * @param string $name The format name |
135 | 135 | * @param string $format A format string |
136 | 136 | */ |
137 | - public static function setFormatDefinition(string $name, string $format): void |
|
137 | + public static function setFormatDefinition( string $name, string $format ): void |
|
138 | 138 | { |
139 | - if (!self::$formats) { |
|
139 | + if ( ! self::$formats ) { |
|
140 | 140 | self::$formats = self::initFormats(); |
141 | 141 | } |
142 | 142 | |
143 | - self::$formats[$name] = $format; |
|
143 | + self::$formats[ $name ] = $format; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return string|null A format string |
152 | 152 | */ |
153 | - public static function getFormatDefinition(string $name): ?string |
|
153 | + public static function getFormatDefinition( string $name ): ?string |
|
154 | 154 | { |
155 | - if (!self::$formats) { |
|
155 | + if ( ! self::$formats ) { |
|
156 | 156 | self::$formats = self::initFormats(); |
157 | 157 | } |
158 | 158 | |
159 | - return self::$formats[$name] ?? null; |
|
159 | + return self::$formats[ $name ] ?? null; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | * @param string $message The text to associate with the placeholder |
170 | 170 | * @param string $name The name of the placeholder |
171 | 171 | */ |
172 | - public function setMessage(string $message, string $name = 'message') |
|
172 | + public function setMessage( string $message, string $name = 'message' ) |
|
173 | 173 | { |
174 | - $this->messages[$name] = $message; |
|
174 | + $this->messages[ $name ] = $message; |
|
175 | 175 | } |
176 | 176 | |
177 | - public function getMessage(string $name = 'message') |
|
177 | + public function getMessage( string $name = 'message' ) |
|
178 | 178 | { |
179 | - return $this->messages[$name]; |
|
179 | + return $this->messages[ $name ]; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | public function getStartTime(): int |
@@ -206,30 +206,30 @@ discard block |
||
206 | 206 | |
207 | 207 | public function getBarOffset(): float |
208 | 208 | { |
209 | - return floor($this->max ? $this->percent * $this->barWidth : (null === $this->redrawFreq ? (int) (min(5, $this->barWidth / 15) * $this->writeCount) : $this->step) % $this->barWidth); |
|
209 | + return floor( $this->max ? $this->percent * $this->barWidth : ( null === $this->redrawFreq ? (int)( min( 5, $this->barWidth / 15 ) * $this->writeCount ) : $this->step ) % $this->barWidth ); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | public function getEstimated(): float |
213 | 213 | { |
214 | - if (!$this->step) { |
|
214 | + if ( ! $this->step ) { |
|
215 | 215 | return 0; |
216 | 216 | } |
217 | 217 | |
218 | - return round((time() - $this->startTime) / $this->step * $this->max); |
|
218 | + return round( ( time() - $this->startTime ) / $this->step * $this->max ); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | public function getRemaining(): float |
222 | 222 | { |
223 | - if (!$this->step) { |
|
223 | + if ( ! $this->step ) { |
|
224 | 224 | return 0; |
225 | 225 | } |
226 | 226 | |
227 | - return round((time() - $this->startTime) / $this->step * ($this->max - $this->step)); |
|
227 | + return round( ( time() - $this->startTime ) / $this->step * ( $this->max - $this->step ) ); |
|
228 | 228 | } |
229 | 229 | |
230 | - public function setBarWidth(int $size) |
|
230 | + public function setBarWidth( int $size ) |
|
231 | 231 | { |
232 | - $this->barWidth = max(1, $size); |
|
232 | + $this->barWidth = max( 1, $size ); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | public function getBarWidth(): int |
@@ -237,21 +237,21 @@ discard block |
||
237 | 237 | return $this->barWidth; |
238 | 238 | } |
239 | 239 | |
240 | - public function setBarCharacter(string $char) |
|
240 | + public function setBarCharacter( string $char ) |
|
241 | 241 | { |
242 | 242 | $this->barChar = $char; |
243 | 243 | } |
244 | 244 | |
245 | 245 | public function getBarCharacter(): string |
246 | 246 | { |
247 | - if (null === $this->barChar) { |
|
247 | + if ( null === $this->barChar ) { |
|
248 | 248 | return $this->max ? '=' : $this->emptyBarChar; |
249 | 249 | } |
250 | 250 | |
251 | 251 | return $this->barChar; |
252 | 252 | } |
253 | 253 | |
254 | - public function setEmptyBarCharacter(string $char) |
|
254 | + public function setEmptyBarCharacter( string $char ) |
|
255 | 255 | { |
256 | 256 | $this->emptyBarChar = $char; |
257 | 257 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | return $this->emptyBarChar; |
262 | 262 | } |
263 | 263 | |
264 | - public function setProgressCharacter(string $char) |
|
264 | + public function setProgressCharacter( string $char ) |
|
265 | 265 | { |
266 | 266 | $this->progressChar = $char; |
267 | 267 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | return $this->progressChar; |
272 | 272 | } |
273 | 273 | |
274 | - public function setFormat(string $format) |
|
274 | + public function setFormat( string $format ) |
|
275 | 275 | { |
276 | 276 | $this->format = null; |
277 | 277 | $this->internalFormat = $format; |
@@ -282,17 +282,17 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @param int|null $freq The frequency in steps |
284 | 284 | */ |
285 | - public function setRedrawFrequency(?int $freq) |
|
285 | + public function setRedrawFrequency( ?int $freq ) |
|
286 | 286 | { |
287 | - $this->redrawFreq = null !== $freq ? max(1, $freq) : null; |
|
287 | + $this->redrawFreq = null !== $freq ? max( 1, $freq ) : null; |
|
288 | 288 | } |
289 | 289 | |
290 | - public function minSecondsBetweenRedraws(float $seconds): void |
|
290 | + public function minSecondsBetweenRedraws( float $seconds ): void |
|
291 | 291 | { |
292 | 292 | $this->minSecondsBetweenRedraws = $seconds; |
293 | 293 | } |
294 | 294 | |
295 | - public function maxSecondsBetweenRedraws(float $seconds): void |
|
295 | + public function maxSecondsBetweenRedraws( float $seconds ): void |
|
296 | 296 | { |
297 | 297 | $this->maxSecondsBetweenRedraws = $seconds; |
298 | 298 | } |
@@ -302,11 +302,11 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable |
304 | 304 | */ |
305 | - public function iterate(iterable $iterable, int $max = null): iterable |
|
305 | + public function iterate( iterable $iterable, int $max = null ): iterable |
|
306 | 306 | { |
307 | - $this->start($max ?? (is_countable($iterable) ? \count($iterable) : 0)); |
|
307 | + $this->start( $max ?? ( is_countable( $iterable ) ? \count( $iterable ) : 0 ) ); |
|
308 | 308 | |
309 | - foreach ($iterable as $key => $value) { |
|
309 | + foreach ( $iterable as $key => $value ) { |
|
310 | 310 | yield $key => $value; |
311 | 311 | |
312 | 312 | $this->advance(); |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | * |
321 | 321 | * @param int|null $max Number of steps to complete the bar (0 if indeterminate), null to leave unchanged |
322 | 322 | */ |
323 | - public function start(int $max = null) |
|
323 | + public function start( int $max = null ) |
|
324 | 324 | { |
325 | 325 | $this->startTime = time(); |
326 | 326 | $this->step = 0; |
327 | 327 | $this->percent = 0.0; |
328 | 328 | |
329 | - if (null !== $max) { |
|
330 | - $this->setMaxSteps($max); |
|
329 | + if ( null !== $max ) { |
|
330 | + $this->setMaxSteps( $max ); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | $this->display(); |
@@ -338,57 +338,57 @@ discard block |
||
338 | 338 | * |
339 | 339 | * @param int $step Number of steps to advance |
340 | 340 | */ |
341 | - public function advance(int $step = 1) |
|
341 | + public function advance( int $step = 1 ) |
|
342 | 342 | { |
343 | - $this->setProgress($this->step + $step); |
|
343 | + $this->setProgress( $this->step + $step ); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
347 | 347 | * Sets whether to overwrite the progressbar, false for new line. |
348 | 348 | */ |
349 | - public function setOverwrite(bool $overwrite) |
|
349 | + public function setOverwrite( bool $overwrite ) |
|
350 | 350 | { |
351 | 351 | $this->overwrite = $overwrite; |
352 | 352 | } |
353 | 353 | |
354 | - public function setProgress(int $step) |
|
354 | + public function setProgress( int $step ) |
|
355 | 355 | { |
356 | - if ($this->max && $step > $this->max) { |
|
356 | + if ( $this->max && $step > $this->max ) { |
|
357 | 357 | $this->max = $step; |
358 | - } elseif ($step < 0) { |
|
358 | + } elseif ( $step < 0 ) { |
|
359 | 359 | $step = 0; |
360 | 360 | } |
361 | 361 | |
362 | - $redrawFreq = $this->redrawFreq ?? (($this->max ?: 10) / 10); |
|
363 | - $prevPeriod = (int) ($this->step / $redrawFreq); |
|
364 | - $currPeriod = (int) ($step / $redrawFreq); |
|
362 | + $redrawFreq = $this->redrawFreq ?? ( ( $this->max ?: 10 ) / 10 ); |
|
363 | + $prevPeriod = (int)( $this->step / $redrawFreq ); |
|
364 | + $currPeriod = (int)( $step / $redrawFreq ); |
|
365 | 365 | $this->step = $step; |
366 | - $this->percent = $this->max ? (float) $this->step / $this->max : 0; |
|
367 | - $timeInterval = microtime(true) - $this->lastWriteTime; |
|
366 | + $this->percent = $this->max ? (float)$this->step / $this->max : 0; |
|
367 | + $timeInterval = microtime( true ) - $this->lastWriteTime; |
|
368 | 368 | |
369 | 369 | // Draw regardless of other limits |
370 | - if ($this->max === $step) { |
|
370 | + if ( $this->max === $step ) { |
|
371 | 371 | $this->display(); |
372 | 372 | |
373 | 373 | return; |
374 | 374 | } |
375 | 375 | |
376 | 376 | // Throttling |
377 | - if ($timeInterval < $this->minSecondsBetweenRedraws) { |
|
377 | + if ( $timeInterval < $this->minSecondsBetweenRedraws ) { |
|
378 | 378 | return; |
379 | 379 | } |
380 | 380 | |
381 | 381 | // Draw each step period, but not too late |
382 | - if ($prevPeriod !== $currPeriod || $timeInterval >= $this->maxSecondsBetweenRedraws) { |
|
382 | + if ( $prevPeriod !== $currPeriod || $timeInterval >= $this->maxSecondsBetweenRedraws ) { |
|
383 | 383 | $this->display(); |
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
387 | - public function setMaxSteps(int $max) |
|
387 | + public function setMaxSteps( int $max ) |
|
388 | 388 | { |
389 | 389 | $this->format = null; |
390 | - $this->max = max(0, $max); |
|
391 | - $this->stepWidth = $this->max ? Helper::width((string) $this->max) : 4; |
|
390 | + $this->max = max( 0, $max ); |
|
391 | + $this->stepWidth = $this->max ? Helper::width( (string)$this->max ) : 4; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -396,16 +396,16 @@ discard block |
||
396 | 396 | */ |
397 | 397 | public function finish(): void |
398 | 398 | { |
399 | - if (!$this->max) { |
|
399 | + if ( ! $this->max ) { |
|
400 | 400 | $this->max = $this->step; |
401 | 401 | } |
402 | 402 | |
403 | - if ($this->step === $this->max && !$this->overwrite) { |
|
403 | + if ( $this->step === $this->max && ! $this->overwrite ) { |
|
404 | 404 | // prevent double 100% output |
405 | 405 | return; |
406 | 406 | } |
407 | 407 | |
408 | - $this->setProgress($this->max); |
|
408 | + $this->setProgress( $this->max ); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -413,15 +413,15 @@ discard block |
||
413 | 413 | */ |
414 | 414 | public function display(): void |
415 | 415 | { |
416 | - if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) { |
|
416 | + if ( OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity() ) { |
|
417 | 417 | return; |
418 | 418 | } |
419 | 419 | |
420 | - if (null === $this->format) { |
|
421 | - $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat()); |
|
420 | + if ( null === $this->format ) { |
|
421 | + $this->setRealFormat( $this->internalFormat ?: $this->determineBestFormat() ); |
|
422 | 422 | } |
423 | 423 | |
424 | - $this->overwrite($this->buildLine()); |
|
424 | + $this->overwrite( $this->buildLine() ); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | /** |
@@ -433,79 +433,79 @@ discard block |
||
433 | 433 | */ |
434 | 434 | public function clear(): void |
435 | 435 | { |
436 | - if (!$this->overwrite) { |
|
436 | + if ( ! $this->overwrite ) { |
|
437 | 437 | return; |
438 | 438 | } |
439 | 439 | |
440 | - if (null === $this->format) { |
|
441 | - $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat()); |
|
440 | + if ( null === $this->format ) { |
|
441 | + $this->setRealFormat( $this->internalFormat ?: $this->determineBestFormat() ); |
|
442 | 442 | } |
443 | 443 | |
444 | - $this->overwrite(''); |
|
444 | + $this->overwrite( '' ); |
|
445 | 445 | } |
446 | 446 | |
447 | - private function setRealFormat(string $format) |
|
447 | + private function setRealFormat( string $format ) |
|
448 | 448 | { |
449 | 449 | // try to use the _nomax variant if available |
450 | - if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) { |
|
451 | - $this->format = self::getFormatDefinition($format.'_nomax'); |
|
452 | - } elseif (null !== self::getFormatDefinition($format)) { |
|
453 | - $this->format = self::getFormatDefinition($format); |
|
450 | + if ( ! $this->max && null !== self::getFormatDefinition( $format . '_nomax' ) ) { |
|
451 | + $this->format = self::getFormatDefinition( $format . '_nomax' ); |
|
452 | + } elseif ( null !== self::getFormatDefinition( $format ) ) { |
|
453 | + $this->format = self::getFormatDefinition( $format ); |
|
454 | 454 | } else { |
455 | 455 | $this->format = $format; |
456 | 456 | } |
457 | 457 | |
458 | - $this->formatLineCount = substr_count($this->format, "\n"); |
|
458 | + $this->formatLineCount = substr_count( $this->format, "\n" ); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
462 | 462 | * Overwrites a previous message to the output. |
463 | 463 | */ |
464 | - private function overwrite(string $message): void |
|
464 | + private function overwrite( string $message ): void |
|
465 | 465 | { |
466 | - if ($this->previousMessage === $message) { |
|
466 | + if ( $this->previousMessage === $message ) { |
|
467 | 467 | return; |
468 | 468 | } |
469 | 469 | |
470 | 470 | $originalMessage = $message; |
471 | 471 | |
472 | - if ($this->overwrite) { |
|
473 | - if (null !== $this->previousMessage) { |
|
474 | - if ($this->output instanceof ConsoleSectionOutput) { |
|
475 | - $messageLines = explode("\n", $message); |
|
476 | - $lineCount = \count($messageLines); |
|
477 | - foreach ($messageLines as $messageLine) { |
|
478 | - $messageLineLength = Helper::width(Helper::removeDecoration($this->output->getFormatter(), $messageLine)); |
|
479 | - if ($messageLineLength > $this->terminal->getWidth()) { |
|
480 | - $lineCount += floor($messageLineLength / $this->terminal->getWidth()); |
|
472 | + if ( $this->overwrite ) { |
|
473 | + if ( null !== $this->previousMessage ) { |
|
474 | + if ( $this->output instanceof ConsoleSectionOutput ) { |
|
475 | + $messageLines = explode( "\n", $message ); |
|
476 | + $lineCount = \count( $messageLines ); |
|
477 | + foreach ( $messageLines as $messageLine ) { |
|
478 | + $messageLineLength = Helper::width( Helper::removeDecoration( $this->output->getFormatter(), $messageLine ) ); |
|
479 | + if ( $messageLineLength > $this->terminal->getWidth() ) { |
|
480 | + $lineCount += floor( $messageLineLength / $this->terminal->getWidth() ); |
|
481 | 481 | } |
482 | 482 | } |
483 | - $this->output->clear($lineCount); |
|
483 | + $this->output->clear( $lineCount ); |
|
484 | 484 | } else { |
485 | - for ($i = 0; $i < $this->formatLineCount; ++$i) { |
|
486 | - $this->cursor->moveToColumn(1); |
|
485 | + for ( $i = 0; $i < $this->formatLineCount; ++$i ) { |
|
486 | + $this->cursor->moveToColumn( 1 ); |
|
487 | 487 | $this->cursor->clearLine(); |
488 | 488 | $this->cursor->moveUp(); |
489 | 489 | } |
490 | 490 | |
491 | - $this->cursor->moveToColumn(1); |
|
491 | + $this->cursor->moveToColumn( 1 ); |
|
492 | 492 | $this->cursor->clearLine(); |
493 | 493 | } |
494 | 494 | } |
495 | - } elseif ($this->step > 0) { |
|
496 | - $message = \PHP_EOL.$message; |
|
495 | + } elseif ( $this->step > 0 ) { |
|
496 | + $message = \PHP_EOL . $message; |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | $this->previousMessage = $originalMessage; |
500 | - $this->lastWriteTime = microtime(true); |
|
500 | + $this->lastWriteTime = microtime( true ); |
|
501 | 501 | |
502 | - $this->output->write($message); |
|
502 | + $this->output->write( $message ); |
|
503 | 503 | ++$this->writeCount; |
504 | 504 | } |
505 | 505 | |
506 | 506 | private function determineBestFormat(): string |
507 | 507 | { |
508 | - switch ($this->output->getVerbosity()) { |
|
508 | + switch ( $this->output->getVerbosity() ) { |
|
509 | 509 | // OutputInterface::VERBOSITY_QUIET: display is disabled anyway |
510 | 510 | case OutputInterface::VERBOSITY_VERBOSE: |
511 | 511 | return $this->max ? self::FORMAT_VERBOSE : self::FORMAT_VERBOSE_NOMAX; |
@@ -521,44 +521,44 @@ discard block |
||
521 | 521 | private static function initPlaceholderFormatters(): array |
522 | 522 | { |
523 | 523 | return [ |
524 | - 'bar' => function (self $bar, OutputInterface $output) { |
|
524 | + 'bar' => function( self $bar, OutputInterface $output ) { |
|
525 | 525 | $completeBars = $bar->getBarOffset(); |
526 | - $display = str_repeat($bar->getBarCharacter(), $completeBars); |
|
527 | - if ($completeBars < $bar->getBarWidth()) { |
|
528 | - $emptyBars = $bar->getBarWidth() - $completeBars - Helper::length(Helper::removeDecoration($output->getFormatter(), $bar->getProgressCharacter())); |
|
529 | - $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars); |
|
526 | + $display = str_repeat( $bar->getBarCharacter(), $completeBars ); |
|
527 | + if ( $completeBars < $bar->getBarWidth() ) { |
|
528 | + $emptyBars = $bar->getBarWidth() - $completeBars - Helper::length( Helper::removeDecoration( $output->getFormatter(), $bar->getProgressCharacter() ) ); |
|
529 | + $display .= $bar->getProgressCharacter() . str_repeat( $bar->getEmptyBarCharacter(), $emptyBars ); |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | return $display; |
533 | 533 | }, |
534 | - 'elapsed' => function (self $bar) { |
|
535 | - return Helper::formatTime(time() - $bar->getStartTime()); |
|
534 | + 'elapsed' => function( self $bar ) { |
|
535 | + return Helper::formatTime( time() - $bar->getStartTime() ); |
|
536 | 536 | }, |
537 | - 'remaining' => function (self $bar) { |
|
538 | - if (!$bar->getMaxSteps()) { |
|
539 | - throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.'); |
|
537 | + 'remaining' => function( self $bar ) { |
|
538 | + if ( ! $bar->getMaxSteps() ) { |
|
539 | + throw new LogicException( 'Unable to display the remaining time if the maximum number of steps is not set.' ); |
|
540 | 540 | } |
541 | 541 | |
542 | - return Helper::formatTime($bar->getRemaining()); |
|
542 | + return Helper::formatTime( $bar->getRemaining() ); |
|
543 | 543 | }, |
544 | - 'estimated' => function (self $bar) { |
|
545 | - if (!$bar->getMaxSteps()) { |
|
546 | - throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.'); |
|
544 | + 'estimated' => function( self $bar ) { |
|
545 | + if ( ! $bar->getMaxSteps() ) { |
|
546 | + throw new LogicException( 'Unable to display the estimated time if the maximum number of steps is not set.' ); |
|
547 | 547 | } |
548 | 548 | |
549 | - return Helper::formatTime($bar->getEstimated()); |
|
549 | + return Helper::formatTime( $bar->getEstimated() ); |
|
550 | 550 | }, |
551 | - 'memory' => function (self $bar) { |
|
552 | - return Helper::formatMemory(memory_get_usage(true)); |
|
551 | + 'memory' => function( self $bar ) { |
|
552 | + return Helper::formatMemory( memory_get_usage( true ) ); |
|
553 | 553 | }, |
554 | - 'current' => function (self $bar) { |
|
555 | - return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT); |
|
554 | + 'current' => function( self $bar ) { |
|
555 | + return str_pad( $bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT ); |
|
556 | 556 | }, |
557 | - 'max' => function (self $bar) { |
|
557 | + 'max' => function( self $bar ) { |
|
558 | 558 | return $bar->getMaxSteps(); |
559 | 559 | }, |
560 | - 'percent' => function (self $bar) { |
|
561 | - return floor($bar->getProgressPercent() * 100); |
|
560 | + 'percent' => function( self $bar ) { |
|
561 | + return floor( $bar->getProgressPercent() * 100 ); |
|
562 | 562 | }, |
563 | 563 | ]; |
564 | 564 | } |
@@ -583,37 +583,37 @@ discard block |
||
583 | 583 | private function buildLine(): string |
584 | 584 | { |
585 | 585 | $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i"; |
586 | - $callback = function ($matches) { |
|
587 | - if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) { |
|
588 | - $text = $formatter($this, $this->output); |
|
589 | - } elseif (isset($this->messages[$matches[1]])) { |
|
590 | - $text = $this->messages[$matches[1]]; |
|
586 | + $callback = function( $matches ) { |
|
587 | + if ( $formatter = $this::getPlaceholderFormatterDefinition( $matches[ 1 ] ) ) { |
|
588 | + $text = $formatter( $this, $this->output ); |
|
589 | + } elseif ( isset( $this->messages[ $matches[ 1 ] ] ) ) { |
|
590 | + $text = $this->messages[ $matches[ 1 ] ]; |
|
591 | 591 | } else { |
592 | - return $matches[0]; |
|
592 | + return $matches[ 0 ]; |
|
593 | 593 | } |
594 | 594 | |
595 | - if (isset($matches[2])) { |
|
596 | - $text = sprintf('%'.$matches[2], $text); |
|
595 | + if ( isset( $matches[ 2 ] ) ) { |
|
596 | + $text = sprintf( '%' . $matches[ 2 ], $text ); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | return $text; |
600 | 600 | }; |
601 | - $line = preg_replace_callback($regex, $callback, $this->format); |
|
601 | + $line = preg_replace_callback( $regex, $callback, $this->format ); |
|
602 | 602 | |
603 | 603 | // gets string length for each sub line with multiline format |
604 | - $linesLength = array_map(function ($subLine) { |
|
605 | - return Helper::width(Helper::removeDecoration($this->output->getFormatter(), rtrim($subLine, "\r"))); |
|
606 | - }, explode("\n", $line)); |
|
604 | + $linesLength = array_map( function( $subLine ) { |
|
605 | + return Helper::width( Helper::removeDecoration( $this->output->getFormatter(), rtrim( $subLine, "\r" ) ) ); |
|
606 | + }, explode( "\n", $line ) ); |
|
607 | 607 | |
608 | - $linesWidth = max($linesLength); |
|
608 | + $linesWidth = max( $linesLength ); |
|
609 | 609 | |
610 | 610 | $terminalWidth = $this->terminal->getWidth(); |
611 | - if ($linesWidth <= $terminalWidth) { |
|
611 | + if ( $linesWidth <= $terminalWidth ) { |
|
612 | 612 | return $line; |
613 | 613 | } |
614 | 614 | |
615 | - $this->setBarWidth($this->barWidth - $linesWidth + $terminalWidth); |
|
615 | + $this->setBarWidth( $this->barWidth - $linesWidth + $terminalWidth ); |
|
616 | 616 | |
617 | - return preg_replace_callback($regex, $callback, $this->format); |
|
617 | + return preg_replace_callback( $regex, $callback, $this->format ); |
|
618 | 618 | } |
619 | 619 | } |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | 'right' => \STR_PAD_LEFT, |
41 | 41 | ]; |
42 | 42 | |
43 | - public function __construct(array $options = []) |
|
43 | + public function __construct( array $options = [ ] ) |
|
44 | 44 | { |
45 | - if ($diff = array_diff(array_keys($options), array_keys($this->options))) { |
|
46 | - throw new InvalidArgumentException(sprintf('The TableCellStyle does not support the following options: \'%s\'.', implode('\', \'', $diff))); |
|
45 | + if ( $diff = array_diff( array_keys( $options ), array_keys( $this->options ) ) ) { |
|
46 | + throw new InvalidArgumentException( sprintf( 'The TableCellStyle does not support the following options: \'%s\'.', implode( '\', \'', $diff ) ) ); |
|
47 | 47 | } |
48 | 48 | |
49 | - if (isset($options['align']) && !\array_key_exists($options['align'], $this->alignMap)) { |
|
50 | - throw new InvalidArgumentException(sprintf('Wrong align value. Value must be following: \'%s\'.', implode('\', \'', array_keys($this->alignMap)))); |
|
49 | + if ( isset( $options[ 'align' ] ) && ! \array_key_exists( $options[ 'align' ], $this->alignMap ) ) { |
|
50 | + throw new InvalidArgumentException( sprintf( 'Wrong align value. Value must be following: \'%s\'.', implode( '\', \'', array_keys( $this->alignMap ) ) ) ); |
|
51 | 51 | } |
52 | 52 | |
53 | - $this->options = array_merge($this->options, $options); |
|
53 | + $this->options = array_merge( $this->options, $options ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | public function getOptions(): array |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | { |
68 | 68 | return array_filter( |
69 | 69 | $this->getOptions(), |
70 | - function ($key) { |
|
71 | - return \in_array($key, $this->tagOptions) && isset($this->options[$key]); |
|
70 | + function( $key ) { |
|
71 | + return \in_array( $key, $this->tagOptions ) && isset( $this->options[ $key ] ); |
|
72 | 72 | }, |
73 | 73 | \ARRAY_FILTER_USE_KEY |
74 | 74 | ); |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | |
77 | 77 | public function getPadByAlign() |
78 | 78 | { |
79 | - return $this->alignMap[$this->getOptions()['align']]; |
|
79 | + return $this->alignMap[ $this->getOptions()[ 'align' ] ]; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function getCellFormat(): ?string |
83 | 83 | { |
84 | - return $this->getOptions()['cellFormat']; |
|
84 | + return $this->getOptions()[ 'cellFormat' ]; |
|
85 | 85 | } |
86 | 86 | } |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return $this |
55 | 55 | */ |
56 | - public function setPaddingChar(string $paddingChar) |
|
56 | + public function setPaddingChar( string $paddingChar ) |
|
57 | 57 | { |
58 | - if (!$paddingChar) { |
|
59 | - throw new LogicException('The padding char must not be empty.'); |
|
58 | + if ( ! $paddingChar ) { |
|
59 | + throw new LogicException( 'The padding char must not be empty.' ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $this->paddingChar = $paddingChar; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * ╚═══════════════╧══════════════════════════╧══════════════════╝ |
89 | 89 | * </code> |
90 | 90 | */ |
91 | - public function setHorizontalBorderChars(string $outside, string $inside = null): self |
|
91 | + public function setHorizontalBorderChars( string $outside, string $inside = null ): self |
|
92 | 92 | { |
93 | 93 | $this->horizontalOutsideBorderChar = $outside; |
94 | 94 | $this->horizontalInsideBorderChar = $inside ?? $outside; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * ╚═══════════════╧══════════════════════════╧══════════════════╝ |
112 | 112 | * </code> |
113 | 113 | */ |
114 | - public function setVerticalBorderChars(string $outside, string $inside = null): self |
|
114 | + public function setVerticalBorderChars( string $outside, string $inside = null ): self |
|
115 | 115 | { |
116 | 116 | $this->verticalOutsideBorderChar = $outside; |
117 | 117 | $this->verticalInsideBorderChar = $inside ?? $outside; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param string|null $topMidBottom Top mid bottom char (see #0' of example), equals to $cross if null |
164 | 164 | * @param string|null $topRightBottom Top right bottom char (see #4' of example), equals to $midRight if null |
165 | 165 | */ |
166 | - public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = null, string $topMidBottom = null, string $topRightBottom = null): self |
|
166 | + public function setCrossingChars( string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = null, string $topMidBottom = null, string $topRightBottom = null ): self |
|
167 | 167 | { |
168 | 168 | $this->crossingChar = $cross; |
169 | 169 | $this->crossingTopLeftChar = $topLeft; |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | * |
187 | 187 | * @see {@link setCrossingChars()} for setting each crossing individually. |
188 | 188 | */ |
189 | - public function setDefaultCrossingChar(string $char): self |
|
189 | + public function setDefaultCrossingChar( string $char ): self |
|
190 | 190 | { |
191 | - return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char); |
|
191 | + return $this->setCrossingChars( $char, $char, $char, $char, $char, $char, $char, $char, $char ); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return $this |
231 | 231 | */ |
232 | - public function setCellHeaderFormat(string $cellHeaderFormat) |
|
232 | + public function setCellHeaderFormat( string $cellHeaderFormat ) |
|
233 | 233 | { |
234 | 234 | $this->cellHeaderFormat = $cellHeaderFormat; |
235 | 235 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * |
252 | 252 | * @return $this |
253 | 253 | */ |
254 | - public function setCellRowFormat(string $cellRowFormat) |
|
254 | + public function setCellRowFormat( string $cellRowFormat ) |
|
255 | 255 | { |
256 | 256 | $this->cellRowFormat = $cellRowFormat; |
257 | 257 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return $this |
275 | 275 | */ |
276 | - public function setCellRowContentFormat(string $cellRowContentFormat) |
|
276 | + public function setCellRowContentFormat( string $cellRowContentFormat ) |
|
277 | 277 | { |
278 | 278 | $this->cellRowContentFormat = $cellRowContentFormat; |
279 | 279 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @return $this |
297 | 297 | */ |
298 | - public function setBorderFormat(string $borderFormat) |
|
298 | + public function setBorderFormat( string $borderFormat ) |
|
299 | 299 | { |
300 | 300 | $this->borderFormat = $borderFormat; |
301 | 301 | |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return $this |
319 | 319 | */ |
320 | - public function setPadType(int $padType) |
|
320 | + public function setPadType( int $padType ) |
|
321 | 321 | { |
322 | - if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], true)) { |
|
323 | - throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).'); |
|
322 | + if ( ! \in_array( $padType, [ \STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH ], true ) ) { |
|
323 | + throw new InvalidArgumentException( 'Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).' ); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | $this->padType = $padType; |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | return $this->headerTitleFormat; |
344 | 344 | } |
345 | 345 | |
346 | - public function setHeaderTitleFormat(string $format): self |
|
346 | + public function setHeaderTitleFormat( string $format ): self |
|
347 | 347 | { |
348 | 348 | $this->headerTitleFormat = $format; |
349 | 349 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | return $this->footerTitleFormat; |
356 | 356 | } |
357 | 357 | |
358 | - public function setFooterTitleFormat(string $format): self |
|
358 | + public function setFooterTitleFormat( string $format ): self |
|
359 | 359 | { |
360 | 360 | $this->footerTitleFormat = $format; |
361 | 361 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | /** |
22 | 22 | * Sets the helper set associated with this helper. |
23 | 23 | */ |
24 | - public function setHelperSet(HelperSet $helperSet = null); |
|
24 | + public function setHelperSet( HelperSet $helperSet = null ); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Gets the helper set associated with this helper. |
@@ -26,9 +26,9 @@ |
||
26 | 26 | * @param int $code Exception code |
27 | 27 | * @param \Throwable|null $previous Previous exception used for the exception chaining |
28 | 28 | */ |
29 | - public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null) |
|
29 | + public function __construct( string $message, array $alternatives = [ ], int $code = 0, \Throwable $previous = null ) |
|
30 | 30 | { |
31 | - parent::__construct($message, $code, $previous); |
|
31 | + parent::__construct( $message, $code, $previous ); |
|
32 | 32 | |
33 | 33 | $this->alternatives = $alternatives; |
34 | 34 | } |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | $this->ignoreValidationErrors(); |
35 | 35 | |
36 | 36 | $this |
37 | - ->setName('help') |
|
38 | - ->setDefinition([ |
|
39 | - new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'), |
|
40 | - new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'), |
|
41 | - new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'), |
|
42 | - ]) |
|
43 | - ->setDescription('Display help for a command') |
|
44 | - ->setHelp(<<<'EOF' |
|
37 | + ->setName( 'help' ) |
|
38 | + ->setDefinition( [ |
|
39 | + new InputArgument( 'command_name', InputArgument::OPTIONAL, 'The command name', 'help' ), |
|
40 | + new InputOption( 'format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt' ), |
|
41 | + new InputOption( 'raw', null, InputOption::VALUE_NONE, 'To output raw command help' ), |
|
42 | + ] ) |
|
43 | + ->setDescription( 'Display help for a command' ) |
|
44 | + ->setHelp( <<<'EOF' |
|
45 | 45 | The <info>%command.name%</info> command displays help for a given command: |
46 | 46 | |
47 | 47 | <info>%command.full_name% list</info> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ; |
57 | 57 | } |
58 | 58 | |
59 | - public function setCommand(Command $command) |
|
59 | + public function setCommand( Command $command ) |
|
60 | 60 | { |
61 | 61 | $this->command = $command; |
62 | 62 | } |
@@ -64,17 +64,17 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * {@inheritdoc} |
66 | 66 | */ |
67 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
67 | + protected function execute( InputInterface $input, OutputInterface $output ) |
|
68 | 68 | { |
69 | - if (null === $this->command) { |
|
70 | - $this->command = $this->getApplication()->find($input->getArgument('command_name')); |
|
69 | + if ( null === $this->command ) { |
|
70 | + $this->command = $this->getApplication()->find( $input->getArgument( 'command_name' ) ); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $helper = new DescriptorHelper(); |
74 | - $helper->describe($output, $this->command, [ |
|
75 | - 'format' => $input->getOption('format'), |
|
76 | - 'raw_text' => $input->getOption('raw'), |
|
77 | - ]); |
|
74 | + $helper->describe( $output, $this->command, [ |
|
75 | + 'format' => $input->getOption( 'format' ), |
|
76 | + 'raw_text' => $input->getOption( 'raw' ), |
|
77 | + ] ); |
|
78 | 78 | |
79 | 79 | $this->command = null; |
80 | 80 |
@@ -26,5 +26,5 @@ |
||
26 | 26 | /** |
27 | 27 | * The method will be called when the application is signaled. |
28 | 28 | */ |
29 | - public function handleSignal(int $signal): void; |
|
29 | + public function handleSignal( int $signal ): void; |
|
30 | 30 | } |