You are here

protected function TextDescriptor::describeInputArgument in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/console/Descriptor/TextDescriptor.php \Symfony\Component\Console\Descriptor\TextDescriptor::describeInputArgument()

Describes an InputArgument instance.

Parameters

InputArgument $argument:

array $options:

Return value

string|mixed

Overrides Descriptor::describeInputArgument

1 call to TextDescriptor::describeInputArgument()
TextDescriptor::describeInputDefinition in vendor/symfony/console/Descriptor/TextDescriptor.php
Describes an InputDefinition instance.

File

vendor/symfony/console/Descriptor/TextDescriptor.php, line 32

Class

TextDescriptor
Text descriptor.

Namespace

Symfony\Component\Console\Descriptor

Code

protected function describeInputArgument(InputArgument $argument, array $options = array()) {
  if (null !== $argument
    ->getDefault() && (!is_array($argument
    ->getDefault()) || count($argument
    ->getDefault()))) {
    $default = sprintf('<comment> [default: %s]</comment>', $this
      ->formatDefaultValue($argument
      ->getDefault()));
  }
  else {
    $default = '';
  }
  $totalWidth = isset($options['total_width']) ? $options['total_width'] : strlen($argument
    ->getName());
  $spacingWidth = $totalWidth - strlen($argument
    ->getName()) + 2;
  $this
    ->writeText(sprintf('  <info>%s</info>%s%s%s', $argument
    ->getName(), str_repeat(' ', $spacingWidth), preg_replace('/\\s*[\\r\\n]\\s*/', "\n" . str_repeat(' ', $totalWidth + 17), $argument
    ->getDescription()), $default), $options);
}