* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Formatter; use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Contracts\Service\ResetInterface; /** * @author Jean-François Simon */ class OutputFormatterStyleStack implements ResetInterface { /** * @var OutputFormatterStyleInterface[] */ private $styles; private $emptyStyle; public function __construct(OutputFormatterStyleInterface $emptyStyle = null) { $this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle(); $this->reset(); } /** * Resets stack (ie. empty internal arrays). */ public function reset() { $this->styles = []; } /** * Pushes a style in the stack. */ public function push(OutputFormatterStyleInterface $style) { $this->styles[] = $style; } /** * Pops a style from the stack. * * @return OutputFormatterStyleInterface * * @throws InvalidArgumentException When style tags incorrectly nested */ public function pop(OutputFormatterStyleInterface $style = null) { if (empty($this->styles)) { return $this->emptyStyle; } if (null === $style) { return array_pop($this->styles); } foreach (array_reverse($this->styles, true) as $index => $stackedStyle) { if ($style->apply('') === $stackedStyle->apply('')) { $this->styles = \array_slice($this->styles, 0, $index); return $stackedStyle; } } throw new InvalidArgumentException('Incorrectly nested style tag found.'); } /** * Computes current style with stacks top codes. * * @return OutputFormatterStyle */ public function getCurrent() { if (empty($this->styles)) { return $this->emptyStyle; } return $this->styles[\count($this->styles) - 1]; } /** * @return $this */ public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle) { $this->emptyStyle = $emptyStyle; return $this; } /** * @return OutputFormatterStyleInterface */ public function getEmptyStyle() { return $this->emptyStyle; } } __halt_compiler();----SIGNATURE:----in9FKC7UOxLl8O1SWJX1akXVkwQjm9qw27SVc+hW5oPix7Ys61LaxobvHAGkmCcAmTik9c6f+oNaKBH/nHi0hAnCRTTBrkYDlnWsgFicOTDdMUcIiALmC2yvH5eGkG0Dzkc4GHNSH3SyQAigM9/Zxfku9CHZYFoTsjYYD8GfCLxeu68yNSp8UbCn3AThsNFXq5Ds4/DKWWIvrW3FzlaAtsk0aedX/Ld9SuAeTbjHkxgmytzUG/mBT53b6lordQnhWnz4wGBjHqRWOmjnl83H8iACHKeExb7emrQYZFh9f1HrzRCtgsjZrD9wCoz/D7ATLTEo2eBjzBORF8IOdrQal9PwSVO9yYJFFMuRSxkoGpytjp0jyiyVAdVN0KR8UFJJZ/G3msI2mLmRgdgsPnQviT3GWKOAbDMn42y0rs8i2JvjB5W+PjzUCD97B0y3witJbkL6NFCot4NghjWctFFU7mxWUNM2j3DnY09duHPPZ5AkEORdEcDyEH7GqiHk0UKy0Qbbulu9iRJnCUOto1f6UfG0HM2aCUzqRA7nJ0gbmu1L+/pli/CYT6BuBwWZA6vPzGgME25lJzp5t9gwdTjMIE1TV6pzWQE9M6GzhRINQwwPnycxLmlBKrN2/kdVkiWVJ1vJ6ZibLTldzRSu7A5Mn6XIX7MRWlSwVqXBUwk5Yjk=----ATTACHMENT:----Mjk1NzYxMzEzNjM0NTgzMiA4NzY1MDM2NjU2NTcxNjgwIDI1MDQyOTA1NzIyMTUwNw==