Appends style(s) to the escape sequence

@param int|array $styles

@return null
7764
public function addStyle($styles)
    {
        foreach ((array) $styles as $style) {
            $this->escapeSequence .= Chalk::getEscapeSequence($style);
        }
    }
18842
public function appendStyle($style, array $params = [], $conditional = '')
    {
        return $this->setStyle($style, $params, false, $conditional);
    }
651851
function make_styles_string($styles) {
        if (empty($styles)) {
            return null;
        }

        $string = '';
        foreach($styles as $property => $value) {
            $string .= $property . ':' . $value . ';';
        }
        return $string;
    }
434901
public static function get_styled_dashes( $style, /** Currently unused. @scrutinizer ignore-unused */ Settings $settings ) {
		if ( isset( self::$styles[ $style ] ) ) {
			return new Simple_Dashes(
				self::$styles[ $style ][ self::_PARENTHETICAL ],
				self::$styles[ $style ][ self::_PARENTHETICAL_SPACE ],
				self::$styles[ $style ][ self::_INTERVAL ],
				self::$styles[ $style ][ self::_INTERVAL_SPACE ]
			);
		}

		return null;
	}
850741
public function addCss($css)
    {
        if (!is_array($css)) {

            // Clean css argument from unnecessary spaces
            $css = preg_replace('/[ ]+/', ' ', $css);

            // Do not trust the programmer and convert a possible
            // string of multiple css class notations to array
            $css = explode(' ', $css);
        }

        foreach ($css as $class) {
            $this->css[$class] = $class;
        }
    }
699513
public function addCSSDeclaration($style){
		if(!isset($this->controller)){
			return false;
			}
		$this->controller->style[]=$style;
		return true;
		}
48796
public function addStyles($styles, $styleValue = false)
    {
        $currentStyles = $this->unpackStylesArray();

        if (is_array($styles)) {
            $currentStyles = array_merge($currentStyles, $styles);
        } elseif ($styleValue) {
            $currentStyles[$styles] = $styleValue;
        }

        $this->packStylesArray($currentStyles);

        return $this;
    }
330629
public static function style($string, $style)
    {
        $escapeSequence = ($style instanceof Style) ? $style->getEscapeSequence() : self::getEscapeSequence($style);
        $resetSequence = ($style instanceof Style) ? Style::getResetSequence() : self::getResetSequence($style);

        return $escapeSequence . $string . $resetSequence;
    }
488946
public function addTextStyle(string $style)
    {
        if (!isset(self::$supportedTextStyles[$style])) {
            throw new InvalidArgumentException("Invalid text style \"$style\"");
        }

        // Don't double-add a style
        if (!in_array($style, $this->textStyles)) {
            $this->textStyles[] = $style;
        }
    }
1334333
function applyStyle($text, $styles = [])
    {
        if (!self::$supported)
            return $text;

        if (is_string($styles))
        {
            $styles = [$styles];
        }

        $output = $text;
        foreach ($styles as $style) {
            if (isset(self::$theme[$style])) {
                $output = $this->applyStyle($output, self::$theme[$style]);
            } else {
                if (isset(self::$styles[$style])) {
                    $pre  = $this->escSequence(self::$styles[$style]);
                    $post = $this->escSequence(0);
                } else {
                    $pre = $post = '';
                }

                $output = $pre . $output . $post;
            }
        }

        return $output;
    }
1069651
public function appendStyle($cssStyle)
    {
        $cssStyle = trim($cssStyle, " \n;");
        $cssStyle && $this->styles[] = $cssStyle;
        return $this;
    }
549937
public function style($style)
    {
        if (is_array($style)) {
            $style = implode('; ', array_map(function ($value, $attribute) {
                return "{$attribute}: {$value}";
            }, $style, array_keys($style)));
        }

        return $this->attribute('style', $style);
    }
117808
private function applyStyle($style, $text)
    {
        list($startCode, $endCode) = self::$styles[$style];

        return $startCode . $text . $endCode;
    }
1159029
public static function parse($string, array $styles)
    {
        // style the entire string if no tags are found
        if (false === strpos($string, '{')) {
            return self::style($string, reset($styles));
        }

        $i = 0;

        // loop through each tag in the string
        while (false !== $openTag = strpos($string, '{')) {
            $style = array_key_exists($i, $styles) ? $styles[$i] : end($styles);

            $escapeSequence = ($style instanceof Style) ? $style->getEscapeSequence() : self::getEscapeSequence($style);
            $resetSequence = ($style instanceof Style) ? Style::getResetSequence() : self::getResetSequence($style);

            // replace opening tag
            $string = substr_replace($string, $escapeSequence, $openTag, 1);

            if (false === $closeTag = strpos($string, '}')) {
                $closeTag = strlen($string);
            }

            // don't produce multiple identical reset tags next to each other
            if (substr($string, $closeTag - strlen($resetSequence), strlen($resetSequence)) !== $resetSequence) {
                $string = substr_replace($string, $resetSequence, $closeTag, 1);
            }

            $i++;
        }

        return $string;
    }
765225
public static function parse_css($styles='') {
		ref\cast::string($styles, true);

		// Remove comments.
		while (false !== ($start = mb::strpos($styles, '/*'))) {
			if (false !== ($end = mb::strpos($styles, '*/'))) {
				$styles = \str_replace(
					mb::substr($styles, $start, ($end - $start + 2)),
					'',
					$styles
				);
			}
			else {
				$styles = mb::substr($styles, 0, $start);
			}
		}

		// A few more types of comment wrappers we might see.
		$styles = \str_replace(
			array('<!--', '//-->', '-->', '//<![CDATA[', '//]]>', '<![CDATA[', ']]>'),
			'',
			$styles
		);

		// Standardize quoting.
		ref\sanitize::quotes($styles);
		$styles = \str_replace("'", '"', $styles);

		// Whitespace.
		ref\sanitize::whitespace($styles, 0);

		// Early bail.
		if (! $styles) {
			return array();
		}

		// Substitute brackets for unlikely characters to make parsing easier
		// hopefully nobody's using braille in their stylesheets...
		$styles = \preg_replace('/\{(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)/u', '⠁', $styles);
		$styles = \preg_replace('/\}(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)/u', '⠈', $styles);

		// Put spaces behind and after parentheses.
		$styles = \preg_replace(
			'/\s*(\()\s*(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)/u',
			' (',
			$styles
		);
		$styles = \preg_replace(
			'/\s*(\))\s*(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)/u',
			') ',
			$styles
		);

		// Make sure {} have no whitespace on either end.
		$styles = \preg_replace('/\s*(⠁|⠈|@)\s*/u', '$1', $styles);

		// Push @ rules to their own lines.
		$styles = \str_replace('@', "\n@", $styles);
		$styles = \explode("\n", $styles);
		$styles = \array_map('trim', $styles);

		// Push all rulesets to their own lines (leaving @media-type ones on their own for now).
		foreach ($styles as $k=>$v) {
			// @rule.
			if (0 === \strpos($styles[$k], '@')) {
				// Nested, like @media.
				if (false !== \strpos($styles[$k], '⠈⠈')) {
					$styles[$k] = \preg_replace('/(⠈{2,})/u', "$1\n", $styles[$k]);
				}
				// Not nested, but has properties, like @font-face.
				elseif (false !== \strpos($styles[$k], '⠈')) {
					$styles[$k] = \str_replace('⠈', "⠈\n", $styles[$k]);
				}
				// Just a line, like @import.
				elseif (\preg_match('/;(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)/', $styles[$k])) {
					$styles[$k] = \preg_replace(
						'/;(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)/u',
						";\n",
						$styles[$k],
						1
					);
				}

				$tmp = \explode("\n", $styles[$k]);
				$length = \count($tmp);
				for ($x = 1; $x < $length; ++$x) {
					$tmp[$x] = \str_replace('⠈', "⠈\n", $tmp[$x]);
				}
				$styles[$k] = \implode("\n", $tmp);
			}// end @.
			else {
				$styles[$k] = \str_replace('⠈', "⠈\n", $styles[$k]);
			}
		}
		$styles = \implode("\n", $styles);

		// One more quick formatting thing, we can get rid of spaces
		// between closing) and punctuation.
		$styles = \preg_replace(
			'/\)\s(,|;)(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)/u',
			')$1',
			$styles
		);

		// And between RGB/URL stuff.
		$styles = \preg_replace('/(url|rgba?)\s+\(/', '$1(', $styles);

		$styles = \explode("\n", $styles);
		$styles = \array_filter($styles, 'strlen');

		$out = array();

		// One more time around!
		foreach ($styles as $k=>$v) {
			$styles[$k] = \trim($styles[$k]);

			// Nested rule.
			if (
				(0 === \strpos($styles[$k], '@')) &&
				(false !== \strpos($styles[$k], '⠈⠈'))
			) {
				$tmp = constants::CSS_NESTED;

				// What kind of @ is this?
				\preg_match_all('/^@([a-z\-]+)/ui', $styles[$k], $matches);
				$tmp['@'] = mb::strtolower($matches[1][0]);

				// Find the outermost bit.
				if (false === ($start = mb::strpos($styles[$k], '⠁'))) {
					continue;
				}

				$tmp['selector'] = mb::strtolower(
					\trim(
						mb::substr($styles[$k], 0, $start)
					),
					false,
					true
				);
				$chunk = mb::substr($styles[$k], $start + 1, -1);
				$chunk = \str_replace(array('⠁', '⠈'), array('{', '}'), $chunk);
				$tmp['nest'] = static::parse_css($chunk);

				// And build the raw.
				$tmp['raw'] = $tmp['selector'] . '{';
				foreach ($tmp['nest'] as $n) {
					$tmp['raw'] .= $n['raw'];
				}
				$tmp['raw'] .= '}';
			}// end @.
			else {
				$tmp = constants::CSS_FLAT;

				if (0 === \strpos($styles[$k], '@')) {
					// What kind of @ is this?
					\preg_match_all('/^@([a-z\-]+)/ui', $styles[$k], $matches);
					$tmp['@'] = mb::strtolower($matches[1][0], false);
				}

				// A normal {k:v, k:v}.
				\preg_match_all('/^([^⠁]+)⠁([^⠈]*)⠈/u', $styles[$k], $matches);
				if (\count($matches[0])) {
					// Sorting out selectors is easy.
					$tmp['selectors'] = \explode(',', $matches[1][0]);
					$tmp['selectors'] = \array_map('trim', $tmp['selectors']);

					// Rules a little trickier.
					$rules = \explode(';', $matches[2][0]);
					$rules = \array_map('trim', $rules);
					$rules = \array_filter($rules, 'strlen');
					if (! \count($rules)) {
						continue;
					}

					foreach ($rules as $k2=>$v2) {
						$rules[$k2] = \rtrim($rules[$k2], ';') . ';';
						if (\preg_match(
							'/:(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)/',
							$rules[$k2]
						)) {
							$rules[$k2] = \preg_replace(
								'/:(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)/u',
								"\n",
								$rules[$k2],
								1
							);
							list($key, $value) = \explode("\n", $rules[$k2]);
							$key = mb::strtolower(\trim($key), false);
							$value = \trim($value);
							$tmp['rules'][$key] = $value;
						}
						else {
							$tmp['rules']['__NONE__'] = $value;
						}
					}

					// Build the raw.
					$tmp['raw'] = \implode(',', $tmp['selectors']) . '{';
					foreach ($tmp['rules'] as $k=>$v) {
						if ('__NONE__' === $k) {
							$tmp['raw'] .= $v;
						}
						else {
							$tmp['raw'] .= "$k:$v";
						}
					}
					$tmp['raw'] .= '}';
				}
				// Who knows?
				else {
					$styles[$k] = \str_replace(array('⠁', '⠈'), array('{', '}'), $styles[$k]);
					$styles[$k] = \trim(\rtrim(\trim($styles[$k]), ';'));
					if (\substr($styles[$k], -1) !== '}') {
						$styles[$k] .= ';';
					}
					$tmp['rules'][] = $styles[$k];
					$tmp['raw'] = $styles[$k];
				}
			}

			$out[] = $tmp;
		}

		return $out;
	}
947456
public function addStyle($property, $style = null)
    {
        if (is_array($property) && is_null($style)) {
            foreach ($property as $k => $v) {
                $this->addStyle($k, $v);
            }

            return $this;
        }
        $this->template->append('style', ';'.$property.':'.$style);

        return $this;
    }
79985
public function render(array $style)
    {
        $result = [];

        if (isset($style['feature'])) {
            $result[] = $this->renderStyle('feature', $style['feature']);
        }

        if (isset($style['element'])) {
            $result[] = $this->renderStyle('element', $style['element']);
        }

        foreach ($style['rules'] as $rule => $value) {
            $result[] = $this->renderStyle($rule, $value);
        }

        return implode('|', $result);
    }