*/
private $styles;
- /**
- * @var OutputFormatterStyleInterface
- */
private $emptyStyle;
- /**
- * Constructor.
- *
- * @param OutputFormatterStyleInterface|null $emptyStyle
- */
public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
{
$this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
/**
* Pushes a style in the stack.
- *
- * @param OutputFormatterStyleInterface $style
*/
public function push(OutputFormatterStyleInterface $style)
{
/**
* Pops a style from the stack.
*
- * @param OutputFormatterStyleInterface|null $style
- *
* @return OutputFormatterStyleInterface
*
* @throws InvalidArgumentException When style tags incorrectly nested
foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
if ($style->apply('') === $stackedStyle->apply('')) {
- $this->styles = array_slice($this->styles, 0, $index);
+ $this->styles = \array_slice($this->styles, 0, $index);
return $stackedStyle;
}
return $this->emptyStyle;
}
- return $this->styles[count($this->styles) - 1];
+ return $this->styles[\count($this->styles) - 1];
}
/**
- * @param OutputFormatterStyleInterface $emptyStyle
- *
* @return $this
*/
public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)