summaryrefslogtreecommitdiffstats
path: root/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter
diff options
context:
space:
mode:
Diffstat (limited to 'Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter')
-rw-r--r--Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatter.php241
-rw-r--r--Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterInterface.php83
-rw-r--r--Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyle.php227
-rw-r--r--Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php72
-rw-r--r--Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php121
5 files changed, 0 insertions, 744 deletions
diff --git a/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatter.php b/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatter.php
deleted file mode 100644
index 90b1970..0000000
--- a/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatter.php
+++ /dev/null
@@ -1,241 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Console\Formatter;
-
-/**
- * Formatter class for console output.
- *
- * @author Konstantin Kudryashov <ever.zet@gmail.com>
- *
- * @api
- */
-class OutputFormatter implements OutputFormatterInterface
-{
- private $decorated;
- private $styles = array();
- private $styleStack;
-
- /**
- * Escapes "<" special char in given text.
- *
- * @param string $text Text to escape
- *
- * @return string Escaped text
- */
- public static function escape($text)
- {
- return preg_replace('/([^\\\\]?)</is', '$1\\<', $text);
- }
-
- /**
- * Initializes console output formatter.
- *
- * @param bool $decorated Whether this formatter should actually decorate strings
- * @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances
- *
- * @api
- */
- 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();
- }
-
- /**
- * Sets the decorated flag.
- *
- * @param bool $decorated Whether to decorate the messages or not
- *
- * @api
- */
- public function setDecorated($decorated)
- {
- $this->decorated = (bool) $decorated;
- }
-
- /**
- * Gets the decorated flag.
- *
- * @return bool true if the output will decorate messages, false otherwise
- *
- * @api
- */
- public function isDecorated()
- {
- return $this->decorated;
- }
-
- /**
- * Sets a new style.
- *
- * @param string $name The style name
- * @param OutputFormatterStyleInterface $style The style instance
- *
- * @api
- */
- public function setStyle($name, OutputFormatterStyleInterface $style)
- {
- $this->styles[strtolower($name)] = $style;
- }
-
- /**
- * Checks if output formatter has style with specified name.
- *
- * @param string $name
- *
- * @return bool
- *
- * @api
- */
- public function hasStyle($name)
- {
- return isset($this->styles[strtolower($name)]);
- }
-
- /**
- * Gets style options from style with specified name.
- *
- * @param string $name
- *
- * @return OutputFormatterStyleInterface
- *
- * @throws \InvalidArgumentException When style isn't defined
- *
- * @api
- */
- public function getStyle($name)
- {
- if (!$this->hasStyle($name)) {
- throw new \InvalidArgumentException(sprintf('Undefined style: %s', $name));
- }
-
- return $this->styles[strtolower($name)];
- }
-
- /**
- * Formats a message according to the given styles.
- *
- * @param string $message The message to style
- *
- * @return string The styled message
- *
- * @api
- */
- public function format($message)
- {
- $offset = 0;
- $output = '';
- $tagRegex = '[a-z][a-z0-9_=;-]*';
- preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#isx", $message, $matches, PREG_OFFSET_CAPTURE);
- foreach ($matches[0] as $i => $match) {
- $pos = $match[1];
- $text = $match[0];
-
- if (0 != $pos && '\\' == $message[$pos - 1]) {
- continue;
- }
-
- // add the text up to the next tag
- $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
- $offset = $pos + strlen($text);
-
- // opening tag?
- if ($open = '/' != $text[1]) {
- $tag = $matches[1][$i][0];
- } else {
- $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
- }
-
- if (!$open && !$tag) {
- // </>
- $this->styleStack->pop();
- } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
- $output .= $this->applyCurrentStyle($text);
- } elseif ($open) {
- $this->styleStack->push($style);
- } else {
- $this->styleStack->pop($style);
- }
- }
-
- $output .= $this->applyCurrentStyle(substr($message, $offset));
-
- return str_replace('\\<', '<', $output);
- }
-
- /**
- * @return OutputFormatterStyleStack
- */
- public function getStyleStack()
- {
- return $this->styleStack;
- }
-
- /**
- * Tries to create new style instance from string.
- *
- * @param string $string
- *
- * @return OutputFormatterStyle|bool false if string is not format string
- */
- private function createStyleFromString($string)
- {
- if (isset($this->styles[$string])) {
- return $this->styles[$string];
- }
-
- if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
- return false;
- }
-
- $style = new OutputFormatterStyle();
- foreach ($matches as $match) {
- array_shift($match);
-
- if ('fg' == $match[0]) {
- $style->setForeground($match[1]);
- } elseif ('bg' == $match[0]) {
- $style->setBackground($match[1]);
- } else {
- try {
- $style->setOption($match[1]);
- } catch (\InvalidArgumentException $e) {
- return false;
- }
- }
- }
-
- return $style;
- }
-
- /**
- * Applies current style from stack to text, if must be applied.
- *
- * @param string $text Input text
- *
- * @return string Styled text
- */
- private function applyCurrentStyle($text)
- {
- return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
- }
-}
diff --git a/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterInterface.php b/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterInterface.php
deleted file mode 100644
index 52efa31..0000000
--- a/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterInterface.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Console\Formatter;
-
-/**
- * Formatter interface for console output.
- *
- * @author Konstantin Kudryashov <ever.zet@gmail.com>
- *
- * @api
- */
-interface OutputFormatterInterface
-{
- /**
- * Sets the decorated flag.
- *
- * @param bool $decorated Whether to decorate the messages or not
- *
- * @api
- */
- public function setDecorated($decorated);
-
- /**
- * Gets the decorated flag.
- *
- * @return bool true if the output will decorate messages, false otherwise
- *
- * @api
- */
- public function isDecorated();
-
- /**
- * Sets a new style.
- *
- * @param string $name The style name
- * @param OutputFormatterStyleInterface $style The style instance
- *
- * @api
- */
- public function setStyle($name, OutputFormatterStyleInterface $style);
-
- /**
- * Checks if output formatter has style with specified name.
- *
- * @param string $name
- *
- * @return bool
- *
- * @api
- */
- public function hasStyle($name);
-
- /**
- * Gets style options from style with specified name.
- *
- * @param string $name
- *
- * @return OutputFormatterStyleInterface
- *
- * @api
- */
- public function getStyle($name);
-
- /**
- * Formats a message according to the given styles.
- *
- * @param string $message The message to style
- *
- * @return string The styled message
- *
- * @api
- */
- public function format($message);
-}
diff --git a/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
deleted file mode 100644
index b3f274a..0000000
--- a/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
+++ /dev/null
@@ -1,227 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Console\Formatter;
-
-/**
- * Formatter style class for defining styles.
- *
- * @author Konstantin Kudryashov <ever.zet@gmail.com>
- *
- * @api
- */
-class OutputFormatterStyle implements OutputFormatterStyleInterface
-{
- private static $availableForegroundColors = array(
- 'black' => array('set' => 30, 'unset' => 39),
- 'red' => array('set' => 31, 'unset' => 39),
- 'green' => array('set' => 32, 'unset' => 39),
- 'yellow' => array('set' => 33, 'unset' => 39),
- 'blue' => array('set' => 34, 'unset' => 39),
- 'magenta' => array('set' => 35, 'unset' => 39),
- 'cyan' => array('set' => 36, 'unset' => 39),
- 'white' => array('set' => 37, 'unset' => 39),
- );
- private static $availableBackgroundColors = array(
- 'black' => array('set' => 40, 'unset' => 49),
- 'red' => array('set' => 41, 'unset' => 49),
- 'green' => array('set' => 42, 'unset' => 49),
- 'yellow' => array('set' => 43, 'unset' => 49),
- 'blue' => array('set' => 44, 'unset' => 49),
- 'magenta' => array('set' => 45, 'unset' => 49),
- 'cyan' => array('set' => 46, 'unset' => 49),
- 'white' => array('set' => 47, 'unset' => 49),
- );
- private static $availableOptions = array(
- 'bold' => array('set' => 1, 'unset' => 22),
- 'underscore' => array('set' => 4, 'unset' => 24),
- 'blink' => array('set' => 5, 'unset' => 25),
- 'reverse' => array('set' => 7, 'unset' => 27),
- 'conceal' => array('set' => 8, 'unset' => 28),
- );
-
- private $foreground;
- private $background;
- private $options = array();
-
- /**
- * Initializes output formatter style.
- *
- * @param string|null $foreground The style foreground color name
- * @param string|null $background The style background color name
- * @param array $options The style options
- *
- * @api
- */
- public function __construct($foreground = null, $background = null, array $options = array())
- {
- if (null !== $foreground) {
- $this->setForeground($foreground);
- }
- if (null !== $background) {
- $this->setBackground($background);
- }
- if (count($options)) {
- $this->setOptions($options);
- }
- }
-
- /**
- * Sets style foreground color.
- *
- * @param string|null $color The color name
- *
- * @throws \InvalidArgumentException When the color name isn't defined
- *
- * @api
- */
- public function setForeground($color = null)
- {
- if (null === $color) {
- $this->foreground = null;
-
- return;
- }
-
- if (!isset(static::$availableForegroundColors[$color])) {
- throw new \InvalidArgumentException(sprintf(
- 'Invalid foreground color specified: "%s". Expected one of (%s)',
- $color,
- implode(', ', array_keys(static::$availableForegroundColors))
- ));
- }
-
- $this->foreground = static::$availableForegroundColors[$color];
- }
-
- /**
- * Sets style background color.
- *
- * @param string|null $color The color name
- *
- * @throws \InvalidArgumentException When the color name isn't defined
- *
- * @api
- */
- public function setBackground($color = null)
- {
- if (null === $color) {
- $this->background = null;
-
- return;
- }
-
- if (!isset(static::$availableBackgroundColors[$color])) {
- throw new \InvalidArgumentException(sprintf(
- 'Invalid background color specified: "%s". Expected one of (%s)',
- $color,
- implode(', ', array_keys(static::$availableBackgroundColors))
- ));
- }
-
- $this->background = static::$availableBackgroundColors[$color];
- }
-
- /**
- * Sets some specific style option.
- *
- * @param string $option The option name
- *
- * @throws \InvalidArgumentException When the option name isn't defined
- *
- * @api
- */
- 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];
- }
- }
-
- /**
- * Unsets some specific style option.
- *
- * @param string $option The option name
- *
- * @throws \InvalidArgumentException When the option name isn't defined
- */
- public function unsetOption($option)
- {
- if (!isset(static::$availableOptions[$option])) {
- throw new \InvalidArgumentException(sprintf(
- 'Invalid option specified: "%s". Expected one of (%s)',
- $option,
- implode(', ', array_keys(static::$availableOptions))
- ));
- }
-
- $pos = array_search(static::$availableOptions[$option], $this->options);
- if (false !== $pos) {
- unset($this->options[$pos]);
- }
- }
-
- /**
- * Sets multiple style options at once.
- *
- * @param array $options
- */
- public function setOptions(array $options)
- {
- $this->options = array();
-
- foreach ($options as $option) {
- $this->setOption($option);
- }
- }
-
- /**
- * Applies the style to a given text.
- *
- * @param string $text The text to style
- *
- * @return string
- */
- public function apply($text)
- {
- $setCodes = array();
- $unsetCodes = array();
-
- if (null !== $this->foreground) {
- $setCodes[] = $this->foreground['set'];
- $unsetCodes[] = $this->foreground['unset'];
- }
- if (null !== $this->background) {
- $setCodes[] = $this->background['set'];
- $unsetCodes[] = $this->background['unset'];
- }
- if (count($this->options)) {
- foreach ($this->options as $option) {
- $setCodes[] = $option['set'];
- $unsetCodes[] = $option['unset'];
- }
- }
-
- if (0 === count($setCodes)) {
- return $text;
- }
-
- return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
- }
-}
diff --git a/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php b/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php
deleted file mode 100644
index e8642b3..0000000
--- a/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Console\Formatter;
-
-/**
- * Formatter style interface for defining styles.
- *
- * @author Konstantin Kudryashov <ever.zet@gmail.com>
- *
- * @api
- */
-interface OutputFormatterStyleInterface
-{
- /**
- * Sets style foreground color.
- *
- * @param string $color The color name
- *
- * @api
- */
- public function setForeground($color = null);
-
- /**
- * Sets style background color.
- *
- * @param string $color The color name
- *
- * @api
- */
- public function setBackground($color = null);
-
- /**
- * Sets some specific style option.
- *
- * @param string $option The option name
- *
- * @api
- */
- public function setOption($option);
-
- /**
- * Unsets some specific style option.
- *
- * @param string $option The option name
- */
- public function unsetOption($option);
-
- /**
- * Sets multiple style options at once.
- *
- * @param array $options
- */
- public function setOptions(array $options);
-
- /**
- * Applies the style to a given text.
- *
- * @param string $text The text to style
- *
- * @return string
- */
- public function apply($text);
-}
diff --git a/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php b/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php
deleted file mode 100644
index b64c87f..0000000
--- a/Aufgabe06/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Console\Formatter;
-
-/**
- * @author Jean-François Simon <contact@jfsimon.fr>
- */
-class OutputFormatterStyleStack
-{
- /**
- * @var OutputFormatterStyleInterface[]
- */
- private $styles;
-
- /**
- * @var OutputFormatterStyleInterface
- */
- private $emptyStyle;
-
- /**
- * Constructor.
- *
- * @param OutputFormatterStyleInterface|null $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 = array();
- }
-
- /**
- * Pushes a style in the stack.
- *
- * @param OutputFormatterStyleInterface $style
- */
- public function push(OutputFormatterStyleInterface $style)
- {
- $this->styles[] = $style;
- }
-
- /**
- * Pops a style from the stack.
- *
- * @param OutputFormatterStyleInterface|null $style
- *
- * @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];
- }
-
- /**
- * @param OutputFormatterStyleInterface $emptyStyle
- *
- * @return OutputFormatterStyleStack
- */
- public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
- {
- $this->emptyStyle = $emptyStyle;
-
- return $this;
- }
-
- /**
- * @return OutputFormatterStyleInterface
- */
- public function getEmptyStyle()
- {
- return $this->emptyStyle;
- }
-}