Symfony\Component\Console\Formatter\OutputFormatter::__construct PHP Метод

__construct() публичный Метод

Initializes console output formatter.
public __construct ( boolean $decorated = false, array $styles = [] )
$decorated boolean Whether this formatter should actually decorate strings
$styles array Array of "name => FormatterStyle" instances
    public function __construct($decorated = false, array $styles = array())
    {
        $this->decorated = (bool) $decorated;
        $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
        $this->setStyle('info', new OutputFormatterStyle('green'));
        $this->setStyle('comment', new OutputFormatterStyle('yellow'));
        $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
        foreach ($styles as $name => $style) {
            $this->setStyle($name, $style);
        }
        $this->styleStack = new OutputFormatterStyleStack();
    }

Usage Example

Пример #1
0
 /**
  * @param boolean $decorated
  *
  * @param array $styles
  */
 public function __construct($decorated = false, array $styles = array())
 {
     parent::__construct($decorated, $styles);
     $this->setStyle('pending', new OutputFormatterStyle('yellow'));
     $this->setStyle('pending-bg', new OutputFormatterStyle('black', 'yellow', array('bold')));
     $this->setStyle('skipped', new OutputFormatterStyle('cyan'));
     $this->setStyle('skipped-bg', new OutputFormatterStyle('white', 'cyan', array('bold')));
     $this->setStyle('failed', new OutputFormatterStyle('red'));
     $this->setStyle('failed-bg', new OutputFormatterStyle('white', 'red', array('bold')));
     $this->setStyle('broken', new OutputFormatterStyle('magenta'));
     $this->setStyle('broken-bg', new OutputFormatterStyle('white', 'magenta', array('bold')));
     $this->setStyle('passed', new OutputFormatterStyle('green'));
     $this->setStyle('passed-bg', new OutputFormatterStyle('black', 'green', array('bold')));
     $this->setStyle('value', new OutputFormatterStyle('yellow'));
     $this->setStyle('lineno', new OutputFormatterStyle(null, 'black'));
     $this->setStyle('code', new OutputFormatterStyle('white'));
     $this->setStyle('hl', new OutputFormatterStyle('black', 'yellow', array('bold')));
     $this->setStyle('question', new OutputFormatterStyle('black', 'yellow', array('bold')));
     $this->setStyle('trace', new OutputFormatterStyle());
     $this->setStyle('trace-class', new OutputFormatterStyle('cyan'));
     $this->setStyle('trace-func', new OutputFormatterStyle('cyan'));
     $this->setStyle('trace-type', new OutputFormatterStyle());
     $this->setStyle('trace-args', new OutputFormatterStyle());
     $this->setStyle('diff-add', new OutputFormatterStyle('green'));
     $this->setStyle('diff-del', new OutputFormatterStyle('red'));
 }
All Usage Examples Of Symfony\Component\Console\Formatter\OutputFormatter::__construct