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

Breadcrumb

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

function TextDescriptor::describeInputArgument

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 31

Class

TextDescriptor
Text descriptor.

Namespace

Symfony\Component\Console\Descriptor

Code

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

API Navigation

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