Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/console/Helper/DescriptorHelper.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
14 use Symfony\Component\Console\Descriptor\DescriptorInterface; | 14 use Symfony\Component\Console\Descriptor\DescriptorInterface; |
15 use Symfony\Component\Console\Descriptor\JsonDescriptor; | 15 use Symfony\Component\Console\Descriptor\JsonDescriptor; |
16 use Symfony\Component\Console\Descriptor\MarkdownDescriptor; | 16 use Symfony\Component\Console\Descriptor\MarkdownDescriptor; |
17 use Symfony\Component\Console\Descriptor\TextDescriptor; | 17 use Symfony\Component\Console\Descriptor\TextDescriptor; |
18 use Symfony\Component\Console\Descriptor\XmlDescriptor; | 18 use Symfony\Component\Console\Descriptor\XmlDescriptor; |
19 use Symfony\Component\Console\Exception\InvalidArgumentException; | |
19 use Symfony\Component\Console\Output\OutputInterface; | 20 use Symfony\Component\Console\Output\OutputInterface; |
20 use Symfony\Component\Console\Exception\InvalidArgumentException; | |
21 | 21 |
22 /** | 22 /** |
23 * This class adds helper method to describe objects in various formats. | 23 * This class adds helper method to describe objects in various formats. |
24 * | 24 * |
25 * @author Jean-François Simon <contact@jfsimon.fr> | 25 * @author Jean-François Simon <contact@jfsimon.fr> |
27 class DescriptorHelper extends Helper | 27 class DescriptorHelper extends Helper |
28 { | 28 { |
29 /** | 29 /** |
30 * @var DescriptorInterface[] | 30 * @var DescriptorInterface[] |
31 */ | 31 */ |
32 private $descriptors = array(); | 32 private $descriptors = []; |
33 | 33 |
34 public function __construct() | 34 public function __construct() |
35 { | 35 { |
36 $this | 36 $this |
37 ->register('txt', new TextDescriptor()) | 37 ->register('txt', new TextDescriptor()) |
52 * @param object $object | 52 * @param object $object |
53 * @param array $options | 53 * @param array $options |
54 * | 54 * |
55 * @throws InvalidArgumentException when the given format is not supported | 55 * @throws InvalidArgumentException when the given format is not supported |
56 */ | 56 */ |
57 public function describe(OutputInterface $output, $object, array $options = array()) | 57 public function describe(OutputInterface $output, $object, array $options = []) |
58 { | 58 { |
59 $options = array_merge(array( | 59 $options = array_merge([ |
60 'raw_text' => false, | 60 'raw_text' => false, |
61 'format' => 'txt', | 61 'format' => 'txt', |
62 ), $options); | 62 ], $options); |
63 | 63 |
64 if (!isset($this->descriptors[$options['format']])) { | 64 if (!isset($this->descriptors[$options['format']])) { |
65 throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format'])); | 65 throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format'])); |
66 } | 66 } |
67 | 67 |