You are here

public function DescriptorHelper::describe in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Helper/DescriptorHelper.php \Symfony\Component\Console\Helper\DescriptorHelper::describe()

Describes an object if supported.

Available options are:

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

Parameters

OutputInterface $output:

object $object:

array $options:

Throws

\InvalidArgumentException when the given format is not supported

File

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

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, array $options = array()) {
  $options = array_merge(array(
    '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);
}