Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TextDescriptor.php

function TextDescriptor::describeInputDefinition

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 86

Class

TextDescriptor
Text descriptor.

Namespace

Symfony\Component\Console\Descriptor

Code

protected function describeInputDefinition(InputDefinition $definition, array $options = []) : void {
    $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
    foreach ($definition->getArguments() as $argument) {
        $totalWidth = max($totalWidth, Helper::width($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, [
                'total_width' => $totalWidth,
            ]));
            $this->writeText("\n");
        }
    }
    if ($definition->getArguments() && $definition->getOptions()) {
        $this->writeText("\n");
    }
    if ($definition->getOptions()) {
        $laterOptions = [];
        $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, [
                'total_width' => $totalWidth,
            ]));
        }
        foreach ($laterOptions as $option) {
            $this->writeText("\n");
            $this->describeInputOption($option, array_merge($options, [
                'total_width' => $totalWidth,
            ]));
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal