PluginProbe
Depicter — Popup & Slider Builder / 1.3.2
Depicter — Popup & Slider Builder v1.3.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / vendor / symfony / console / Descriptor / Descriptor.php

Descriptor.php in Depicter — Popup & Slider Builder 1.3.2, at vendor/symfony/console/Descriptor/Descriptor.php

105 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Console\Descriptor;
13
14 use Symfony\Component\Console\Application;
15 use Symfony\Component\Console\Command\Command;
16 use Symfony\Component\Console\Exception\InvalidArgumentException;
17 use Symfony\Component\Console\Input\InputArgument;
18 use Symfony\Component\Console\Input\InputDefinition;
19 use Symfony\Component\Console\Input\InputOption;
20 use Symfony\Component\Console\Output\OutputInterface;
21
22 /**
23 * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
24 *
25 * @internal
26 */
27 abstract class Descriptor implements DescriptorInterface
28 {
29 /**
30 * @var OutputInterface
31 */
32 protected $output;
33
34 /**
35 * {@inheritdoc}
36 */
37 public function describe(OutputInterface $output, $object, array $options = [])
38 {
39 $this->output = $output;
40
41 switch (true) {
42 case $object instanceof InputArgument:
43 $this->describeInputArgument($object, $options);
44 break;
45 case $object instanceof InputOption:
46 $this->describeInputOption($object, $options);
47 break;
48 case $object instanceof InputDefinition:
49 $this->describeInputDefinition($object, $options);
50 break;
51 case $object instanceof Command:
52 $this->describeCommand($object, $options);
53 break;
54 case $object instanceof Application:
55 $this->describeApplication($object, $options);
56 break;
57 default:
58 throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object)));
59 }
60 }
61
62 /**
63 * Writes content to output.
64 */
65 protected function write(string $content, bool $decorated = false)
66 {
67 $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
68 }
69
70 /**
71 * Describes an InputArgument instance.
72 *
73 * @return string|mixed
74 */
75 abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
76
77 /**
78 * Describes an InputOption instance.
79 *
80 * @return string|mixed
81 */
82 abstract protected function describeInputOption(InputOption $option, array $options = []);
83
84 /**
85 * Describes an InputDefinition instance.
86 *
87 * @return string|mixed
88 */
89 abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
90
91 /**
92 * Describes a Command instance.
93 *
94 * @return string|mixed
95 */
96 abstract protected function describeCommand(Command $command, array $options = []);
97
98 /**
99 * Describes an Application instance.
100 *
101 * @return string|mixed
102 */
103 abstract protected function describeApplication(Application $application, array $options = []);
104 }
105