@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $this->writeText(sprintf(" <info>%-${nameWidth}s</info> %s%s", |
| 43 | 43 | $argument->getName(), |
| 44 | - str_replace("\n", "\n".str_repeat(' ', $nameWidth + 2), $argument->getDescription()), |
|
| 44 | + str_replace("\n", "\n" . str_repeat(' ', $nameWidth + 2), $argument->getDescription()), |
|
| 45 | 45 | $default |
| 46 | 46 | ), $options); |
| 47 | 47 | } |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | $nameWithShortcutWidth = $nameWidth - strlen($option->getName()) - 2; |
| 62 | 62 | |
| 63 | 63 | $this->writeText(sprintf(" <info>%s</info> %-${nameWithShortcutWidth}s%s%s%s", |
| 64 | - '--'.$option->getName(), |
|
| 64 | + '--' . $option->getName(), |
|
| 65 | 65 | $option->getShortcut() ? sprintf('(-%s) ', $option->getShortcut()) : '', |
| 66 | - str_replace("\n", "\n".str_repeat(' ', $nameWidth + 2), $option->getDescription()), |
|
| 66 | + str_replace("\n", "\n" . str_repeat(' ', $nameWidth + 2), $option->getDescription()), |
|
| 67 | 67 | $default, |
| 68 | 68 | $option->isArray() ? '<comment> (multiple values allowed)</comment>' : '' |
| 69 | 69 | ), $options); |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $this->writeText('<comment>Usage:</comment>', $options); |
| 122 | 122 | $this->writeText("\n"); |
| 123 | - $this->writeText(' '.$command->getSynopsis(), $options); |
|
| 123 | + $this->writeText(' ' . $command->getSynopsis(), $options); |
|
| 124 | 124 | $this->writeText("\n"); |
| 125 | 125 | |
| 126 | 126 | if (count($command->getAliases()) > 0) { |
| 127 | 127 | $this->writeText("\n"); |
| 128 | - $this->writeText('<comment>Aliases:</comment> <info>'.implode(', ', $command->getAliases()).'</info>', $options); |
|
| 128 | + $this->writeText('<comment>Aliases:</comment> <info>' . implode(', ', $command->getAliases()) . '</info>', $options); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if ($definition = $command->getNativeDefinition()) { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | if ($help = $command->getProcessedHelp()) { |
| 139 | 139 | $this->writeText('<comment>Help:</comment>', $options); |
| 140 | 140 | $this->writeText("\n"); |
| 141 | - $this->writeText(' '.str_replace("\n", "\n ", $help), $options); |
|
| 141 | + $this->writeText(' ' . str_replace("\n", "\n ", $help), $options); |
|
| 142 | 142 | $this->writeText("\n"); |
| 143 | 143 | } |
| 144 | 144 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | foreach ($description->getNamespaces() as $namespace) { |
| 199 | 199 | if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { |
| 200 | 200 | $this->writeText("\n"); |
| 201 | - $this->writeText('<comment>'.$namespace['id'].'</comment>', $options); |
|
| 201 | + $this->writeText('<comment>' . $namespace['id'] . '</comment>', $options); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | foreach ($namespace['commands'] as $name) { |
@@ -235,13 +235,13 @@ |
||
| 235 | 235 | $dom = new \DOMDocument('1.0', 'UTF-8'); |
| 236 | 236 | |
| 237 | 237 | $dom->appendChild($objectXML = $dom->createElement('option')); |
| 238 | - $objectXML->setAttribute('name', '--'.$option->getName()); |
|
| 238 | + $objectXML->setAttribute('name', '--' . $option->getName()); |
|
| 239 | 239 | $pos = strpos($option->getShortcut(), '|'); |
| 240 | 240 | if (false !== $pos) { |
| 241 | - $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos)); |
|
| 242 | - $objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut()))); |
|
| 241 | + $objectXML->setAttribute('shortcut', '-' . substr($option->getShortcut(), 0, $pos)); |
|
| 242 | + $objectXML->setAttribute('shortcuts', '-' . implode('|-', explode('|', $option->getShortcut()))); |
|
| 243 | 243 | } else { |
| 244 | - $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : ''); |
|
| 244 | + $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-' . $option->getShortcut() : ''); |
|
| 245 | 245 | } |
| 246 | 246 | $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0); |
| 247 | 247 | $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $output->writeln($messages); |
| 56 | 56 | |
| 57 | - $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) { |
|
| 57 | + $result = $this->askAndValidate($output, '> ', function($picked) use ($choices, $errorMessage, $multiselect) { |
|
| 58 | 58 | // Collapse all spaces. |
| 59 | 59 | $selectedChoices = str_replace(' ', '', $picked); |
| 60 | 60 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | // Save cursor position |
| 212 | 212 | $output->write("\0337"); |
| 213 | 213 | // Write highlighted text |
| 214 | - $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>'); |
|
| 214 | + $output->write('<hl>' . substr($matches[$ofs], $i) . '</hl>'); |
|
| 215 | 215 | // Restore cursor position |
| 216 | 216 | $output->write("\0338"); |
| 217 | 217 | } |
@@ -263,11 +263,11 @@ discard block |
||
| 263 | 263 | public function askHiddenResponse(OutputInterface $output, $question, $fallback = true) |
| 264 | 264 | { |
| 265 | 265 | if ('\\' === DIRECTORY_SEPARATOR) { |
| 266 | - $exe = __DIR__.'/../Resources/bin/hiddeninput.exe'; |
|
| 266 | + $exe = __DIR__ . '/../Resources/bin/hiddeninput.exe'; |
|
| 267 | 267 | |
| 268 | 268 | // handle code running from a phar |
| 269 | 269 | if ('phar:' === substr(__FILE__, 0, 5)) { |
| 270 | - $tmpExe = sys_get_temp_dir().'/hiddeninput.exe'; |
|
| 270 | + $tmpExe = sys_get_temp_dir() . '/hiddeninput.exe'; |
|
| 271 | 271 | copy($exe, $tmpExe); |
| 272 | 272 | $exe = $tmpExe; |
| 273 | 273 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | { |
| 342 | 342 | $that = $this; |
| 343 | 343 | |
| 344 | - $interviewer = function () use ($output, $question, $default, $autocomplete, $that) { |
|
| 344 | + $interviewer = function() use ($output, $question, $default, $autocomplete, $that) { |
|
| 345 | 345 | return $that->ask($output, $question, $default, $autocomplete); |
| 346 | 346 | }; |
| 347 | 347 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | { |
| 371 | 371 | $that = $this; |
| 372 | 372 | |
| 373 | - $interviewer = function () use ($output, $question, $fallback, $that) { |
|
| 373 | + $interviewer = function() use ($output, $question, $fallback, $that) { |
|
| 374 | 374 | return $that->askHiddenResponse($output, $question, $fallback); |
| 375 | 375 | }; |
| 376 | 376 | |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | |
| 60 | 60 | $messages = $large ? array(str_repeat(' ', $len)) : array(); |
| 61 | 61 | for ($i = 0; isset($lines[$i]); ++$i) { |
| 62 | - $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i])); |
|
| 62 | + $messages[] = $lines[$i] . str_repeat(' ', $len - $this->strlen($lines[$i])); |
|
| 63 | 63 | } |
| 64 | 64 | if ($large) { |
| 65 | 65 | $messages[] = str_repeat(' ', $len); |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | return $format[1]; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - return ceil($secs / $format[2]).' '.$format[1]; |
|
| 88 | + return ceil($secs / $format[2]) . ' ' . $format[1]; |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | |
| 114 | 114 | $that = $this; |
| 115 | 115 | |
| 116 | - return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) { |
|
| 116 | + return function($type, $buffer) use ($output, $process, $callback, $formatter, $that) { |
|
| 117 | 117 | $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type)); |
| 118 | 118 | |
| 119 | 119 | if (null !== $callback) { |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | public function setFormat($format) |
| 305 | 305 | { |
| 306 | 306 | // try to use the _nomax variant if available |
| 307 | - if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) { |
|
| 308 | - $this->format = self::getFormatDefinition($format.'_nomax'); |
|
| 307 | + if (!$this->max && null !== self::getFormatDefinition($format . '_nomax')) { |
|
| 308 | + $this->format = self::getFormatDefinition($format . '_nomax'); |
|
| 309 | 309 | } elseif (null !== self::getFormatDefinition($format)) { |
| 310 | 310 | $this->format = self::getFormatDefinition($format); |
| 311 | 311 | } else { |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | $self = $this; |
| 437 | 437 | $output = $this->output; |
| 438 | 438 | $messages = $this->messages; |
| 439 | - $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) { |
|
| 439 | + $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function($matches) use ($self, $output, $messages) { |
|
| 440 | 440 | if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) { |
| 441 | 441 | $text = call_user_func($formatter, $self, $output); |
| 442 | 442 | } elseif (isset($messages[$matches[1]])) { |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | if (isset($matches[2])) { |
| 449 | - $text = sprintf('%'.$matches[2], $text); |
|
| 449 | + $text = sprintf('%' . $matches[2], $text); |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | return $text; |
@@ -538,20 +538,20 @@ discard block |
||
| 538 | 538 | private static function initPlaceholderFormatters() |
| 539 | 539 | { |
| 540 | 540 | return array( |
| 541 | - 'bar' => function (ProgressBar $bar, OutputInterface $output) { |
|
| 541 | + 'bar' => function(ProgressBar $bar, OutputInterface $output) { |
|
| 542 | 542 | $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth()); |
| 543 | 543 | $display = str_repeat($bar->getBarCharacter(), $completeBars); |
| 544 | 544 | if ($completeBars < $bar->getBarWidth()) { |
| 545 | 545 | $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter()); |
| 546 | - $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars); |
|
| 546 | + $display .= $bar->getProgressCharacter() . str_repeat($bar->getEmptyBarCharacter(), $emptyBars); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | return $display; |
| 550 | 550 | }, |
| 551 | - 'elapsed' => function (ProgressBar $bar) { |
|
| 551 | + 'elapsed' => function(ProgressBar $bar) { |
|
| 552 | 552 | return Helper::formatTime(time() - $bar->getStartTime()); |
| 553 | 553 | }, |
| 554 | - 'remaining' => function (ProgressBar $bar) { |
|
| 554 | + 'remaining' => function(ProgressBar $bar) { |
|
| 555 | 555 | if (!$bar->getMaxSteps()) { |
| 556 | 556 | throw new \LogicException('Unable to display the remaining time if the maximum number of steps is not set.'); |
| 557 | 557 | } |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | |
| 565 | 565 | return Helper::formatTime($remaining); |
| 566 | 566 | }, |
| 567 | - 'estimated' => function (ProgressBar $bar) { |
|
| 567 | + 'estimated' => function(ProgressBar $bar) { |
|
| 568 | 568 | if (!$bar->getMaxSteps()) { |
| 569 | 569 | throw new \LogicException('Unable to display the estimated time if the maximum number of steps is not set.'); |
| 570 | 570 | } |
@@ -577,16 +577,16 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | return Helper::formatTime($estimated); |
| 579 | 579 | }, |
| 580 | - 'memory' => function (ProgressBar $bar) { |
|
| 580 | + 'memory' => function(ProgressBar $bar) { |
|
| 581 | 581 | return Helper::formatMemory(memory_get_usage(true)); |
| 582 | 582 | }, |
| 583 | - 'current' => function (ProgressBar $bar) { |
|
| 583 | + 'current' => function(ProgressBar $bar) { |
|
| 584 | 584 | return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT); |
| 585 | 585 | }, |
| 586 | - 'max' => function (ProgressBar $bar) { |
|
| 586 | + 'max' => function(ProgressBar $bar) { |
|
| 587 | 587 | return $bar->getMaxSteps(); |
| 588 | 588 | }, |
| 589 | - 'percent' => function (ProgressBar $bar) { |
|
| 589 | + 'percent' => function(ProgressBar $bar) { |
|
| 590 | 590 | return floor($bar->getProgressPercent() * 100); |
| 591 | 591 | }, |
| 592 | 592 | ); |
@@ -416,7 +416,7 @@ |
||
| 416 | 416 | $text = $format[1]; |
| 417 | 417 | break; |
| 418 | 418 | } else { |
| 419 | - $text = ceil($secs / $format[2]).' '.$format[1]; |
|
| 419 | + $text = ceil($secs / $format[2]) . ' ' . $format[1]; |
|
| 420 | 420 | break; |
| 421 | 421 | } |
| 422 | 422 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | $that = $this; |
| 53 | 53 | |
| 54 | - $interviewer = function () use ($output, $question, $that) { |
|
| 54 | + $interviewer = function() use ($output, $question, $that) { |
|
| 55 | 55 | return $that->doAsk($output, $question); |
| 56 | 56 | }; |
| 57 | 57 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | // Save cursor position |
| 267 | 267 | $output->write("\0337"); |
| 268 | 268 | // Write highlighted text |
| 269 | - $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>'); |
|
| 269 | + $output->write('<hl>' . substr($matches[$ofs], $i) . '</hl>'); |
|
| 270 | 270 | // Restore cursor position |
| 271 | 271 | $output->write("\0338"); |
| 272 | 272 | } |
@@ -290,11 +290,11 @@ discard block |
||
| 290 | 290 | private function getHiddenResponse(OutputInterface $output, $inputStream) |
| 291 | 291 | { |
| 292 | 292 | if ('\\' === DIRECTORY_SEPARATOR) { |
| 293 | - $exe = __DIR__.'/../Resources/bin/hiddeninput.exe'; |
|
| 293 | + $exe = __DIR__ . '/../Resources/bin/hiddeninput.exe'; |
|
| 294 | 294 | |
| 295 | 295 | // handle code running from a phar |
| 296 | 296 | if ('phar:' === substr(__FILE__, 0, 5)) { |
| 297 | - $tmpExe = sys_get_temp_dir().'/hiddeninput.exe'; |
|
| 297 | + $tmpExe = sys_get_temp_dir() . '/hiddeninput.exe'; |
|
| 298 | 298 | copy($exe, $tmpExe); |
| 299 | 299 | $exe = $tmpExe; |
| 300 | 300 | } |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) { |
| 359 | 359 | $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error'); |
| 360 | 360 | } else { |
| 361 | - $message = '<error>'.$error->getMessage().'</error>'; |
|
| 361 | + $message = '<error>' . $error->getMessage() . '</error>'; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | $output->writeln($message); |