abstract class Descriptor in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Descriptor/Descriptor.php \Symfony\Component\Console\Descriptor\Descriptor
@author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
@internal
Hierarchy
- class \Symfony\Component\Console\Descriptor\Descriptor implements DescriptorInterface
Expanded class hierarchy of Descriptor
File
- vendor/
symfony/ console/ Descriptor/ Descriptor.php, line 26
Namespace
Symfony\Component\Console\DescriptorView source
abstract class Descriptor implements DescriptorInterface {
/**
* @var OutputInterface
*/
private $output;
/**
* {@inheritdoc}
*/
public function describe(OutputInterface $output, $object, array $options = array()) {
$this->output = $output;
switch (true) {
case $object instanceof InputArgument:
$this
->describeInputArgument($object, $options);
break;
case $object instanceof InputOption:
$this
->describeInputOption($object, $options);
break;
case $object instanceof InputDefinition:
$this
->describeInputDefinition($object, $options);
break;
case $object instanceof Command:
$this
->describeCommand($object, $options);
break;
case $object instanceof Application:
$this
->describeApplication($object, $options);
break;
default:
throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
}
}
/**
* Writes content to output.
*
* @param string $content
* @param bool $decorated
*/
protected function write($content, $decorated = false) {
$this->output
->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
}
/**
* Describes an InputArgument instance.
*
* @param InputArgument $argument
* @param array $options
*
* @return string|mixed
*/
protected abstract function describeInputArgument(InputArgument $argument, array $options = array());
/**
* Describes an InputOption instance.
*
* @param InputOption $option
* @param array $options
*
* @return string|mixed
*/
protected abstract function describeInputOption(InputOption $option, array $options = array());
/**
* Describes an InputDefinition instance.
*
* @param InputDefinition $definition
* @param array $options
*
* @return string|mixed
*/
protected abstract function describeInputDefinition(InputDefinition $definition, array $options = array());
/**
* Describes a Command instance.
*
* @param Command $command
* @param array $options
*
* @return string|mixed
*/
protected abstract function describeCommand(Command $command, array $options = array());
/**
* Describes an Application instance.
*
* @param Application $application
* @param array $options
*
* @return string|mixed
*/
protected abstract function describeApplication(Application $application, array $options = array());
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Descriptor:: |
private | property | ||
Descriptor:: |
public | function |
Describes an InputArgument instance. Overrides DescriptorInterface:: |
|
Descriptor:: |
abstract protected | function | Describes an Application instance. | 4 |
Descriptor:: |
abstract protected | function | Describes a Command instance. | 4 |
Descriptor:: |
abstract protected | function | Describes an InputArgument instance. | 4 |
Descriptor:: |
abstract protected | function | Describes an InputDefinition instance. | 4 |
Descriptor:: |
abstract protected | function | Describes an InputOption instance. | 4 |
Descriptor:: |
protected | function | Writes content to output. |