You are here

public function OutputFormatterStyle::setOption in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Formatter/OutputFormatterStyle.php \Symfony\Component\Console\Formatter\OutputFormatterStyle::setOption()

Sets some specific style option.

Parameters

string $option The option name:

Throws

\InvalidArgumentException When the option name isn't defined

Overrides OutputFormatterStyleInterface::setOption

1 call to OutputFormatterStyle::setOption()
OutputFormatterStyle::setOptions in vendor/symfony/console/Formatter/OutputFormatterStyle.php
Sets multiple style options at once.

File

vendor/symfony/console/Formatter/OutputFormatterStyle.php, line 134

Class

OutputFormatterStyle
Formatter style class for defining styles.

Namespace

Symfony\Component\Console\Formatter

Code

public function setOption($option) {
  if (!isset(static::$availableOptions[$option])) {
    throw new \InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  }
  if (!in_array(static::$availableOptions[$option], $this->options)) {
    $this->options[] = static::$availableOptions[$option];
  }
}