Beispiel #1
0
 /**
  * @param string                        $input
  * @param int                           $verbosity
  * @param OutputFormatterInterface|null $formatter
  */
 public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
 {
     $input = new StringInput($input);
     $input->setInteractive(false);
     $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
     parent::__construct($input, $output, new HelperSet(array()));
 }
Beispiel #2
0
 public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
 {
     $isDecorated = $formatter->isDecorated();
     $formatter->setDecorated(false);
     $string = $formatter->format($string);
     $string = preg_replace("/\\[[^m]*m/", '', $string);
     $formatter->setDecorated($isDecorated);
     return self::strlen($string);
 }
 /**
  * {@inheritdoc}
  */
 public function isDecorated()
 {
     return $this->formatter->isDecorated();
 }