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

Breadcrumb

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

function DescriptorHelper::describe

Describes an object if supported.

Available options are:

  • format: string, the output format name
  • raw_text: boolean, sets output type as raw

Throws

InvalidArgumentException when the given format is not supported

File

vendor/symfony/console/Helper/DescriptorHelper.php, line 55

Class

DescriptorHelper
This class adds helper method to describe objects in various formats.

Namespace

Symfony\Component\Console\Helper

Code

public function describe(OutputInterface $output, ?object $object, array $options = []) : void {
    $options = array_merge([
        'raw_text' => false,
        'format' => 'txt',
    ], $options);
    if (!isset($this->descriptors[$options['format']])) {
        throw new InvalidArgumentException(\sprintf('Unsupported format "%s".', $options['format']));
    }
    $descriptor = $this->descriptors[$options['format']];
    $descriptor->describe($output, $object, $options);
}

API Navigation

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