You are here

protected function TextDescriptor::describeInputDefinition 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::describeInputDefinition()

Describes an InputDefinition instance.

Parameters

InputDefinition $definition:

array $options:

Return value

string|mixed

Overrides Descriptor::describeInputDefinition

2 calls to TextDescriptor::describeInputDefinition()
TextDescriptor::describeApplication in vendor/symfony/console/Descriptor/TextDescriptor.php
Describes an Application instance.
TextDescriptor::describeCommand in vendor/symfony/console/Descriptor/TextDescriptor.php
Describes a Command instance.

File

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

Class

TextDescriptor
Text descriptor.

Namespace

Symfony\Component\Console\Descriptor

Code

protected function describeInputDefinition(InputDefinition $definition, array $options = array()) {
  $totalWidth = $this
    ->calculateTotalWidthForOptions($definition
    ->getOptions());
  foreach ($definition
    ->getArguments() as $argument) {
    $totalWidth = max($totalWidth, strlen($argument
      ->getName()));
  }
  if ($definition
    ->getArguments()) {
    $this
      ->writeText('<comment>Arguments:</comment>', $options);
    $this
      ->writeText("\n");
    foreach ($definition
      ->getArguments() as $argument) {
      $this
        ->describeInputArgument($argument, array_merge($options, array(
        'total_width' => $totalWidth,
      )));
      $this
        ->writeText("\n");
    }
  }
  if ($definition
    ->getArguments() && $definition
    ->getOptions()) {
    $this
      ->writeText("\n");
  }
  if ($definition
    ->getOptions()) {
    $laterOptions = array();
    $this
      ->writeText('<comment>Options:</comment>', $options);
    foreach ($definition
      ->getOptions() as $option) {
      if (strlen($option
        ->getShortcut()) > 1) {
        $laterOptions[] = $option;
        continue;
      }
      $this
        ->writeText("\n");
      $this
        ->describeInputOption($option, array_merge($options, array(
        'total_width' => $totalWidth,
      )));
    }
    foreach ($laterOptions as $option) {
      $this
        ->writeText("\n");
      $this
        ->describeInputOption($option, array_merge($options, array(
        'total_width' => $totalWidth,
      )));
    }
  }
}