Tries to create new style instance from string.

@param string $string

@return OutputFormatterStyle|false false if string is not format string
19790
private function createStyleFromString($string)
    {
        if (isset($this->styles[$string])) {
            return $this->styles[$string];
        }

        if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $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]);
            } elseif ('options' === $match[0]) {
                preg_match_all('([^,;]+)', $match[1], $options);
                $options = array_shift($options);
                foreach ($options as $option) {
                    try {
                        $style->setOption($option);
                    } catch (\InvalidArgumentException $e) {
                        @trigger_error(sprintf('Unknown style options are deprecated since version 3.2 and will be removed in 4.0. Exception "%s".', $e->getMessage()), E_USER_DEPRECATED);

                        return false;
                    }
                }
            } else {
                return false;
            }
        }

        return $style;
    }
427931
public function parseFromString($string){
		$dom = $this->html5->loadHTML($string);
		if( is_a($dom, 'DOMDocument') ){
			return $dom;
		}else{
			return false;
		}
	}
576890
public static function fromString(string $string): self
    {
        if (1 !== \preg_match(self::stringRegex(), $string, $matches)) {
            throw new Exception\InvalidArgumentException(\sprintf(
                'String "%s" does not appear to be a valid string.',
                $string
            ));
        }

        return new self(
            $matches['owner'],
            $matches['name']
        );
    }
582813
public function write($string)
    {
        if ($this->fd) {
            $ret = fwrite($this->fd, $string);
            if ($ret !== FALSE) {
                return $ret; 
            }
        }

        return false;
    }
679380
public function startsWith($string)
	{
		$string = static::_convertString($string, $this->encoding);
		return $string === $this->substring(0, mb_strlen($string, $this->encoding)-1)->__toString();
	}
1340796
protected function _formatString($string)
    {
        $quote = substr($string, 0, 1);
        $string = substr($string, 1, -1);
        if ($quote === '"') {
            $string = stripcslashes($string);
        } else {
            $string = strtr($string, ["\\'" => "'", '\\\\' => '\\']);
        }
        $string = str_replace("\r\n", "\n", $string);

        return addcslashes($string, "\0..\37\\\"");
    }
963257
public function style($string, $colourOrStyle)
    {
        if (is_array($colourOrStyle)) {
            $this->color->__invoke($string);

            while ($style = array_shift($colourOrStyle)) {
                $this->color->apply($style);
            }
            return $this->color->__toString();
        }

        return $this->color->__invoke($string)->apply($colourOrStyle, $string);
    }
655693
protected function manipulate($string)
    {
        $chunks = $this->getKeysFromString($string);
        $array = $this->getArray();

        return $this->formatArray($array, $chunks);
    }
826012
public function format($text = '', string $style = 'none')
    {
        return $this->getStartMark($style) . $text . $this->getClearMark();
    }
743836
public function getTidy($string)
    {
        if (class_exists('Tidy')) {
            if (!$this->_tidy) {
                $this->_tidy = new Tidy();
            }

            $this->_tidy->parseString($string, $this->_config, $this->_encoding);
        }

        return $this->_tidy;
    }
719838
final public static function handlifyString($string)
    {
        $string = preg_replace('/\W+/', '_', $string);
        $string = preg_replace('/([A-Z])/', '_$1', $string);
        $string = strtolower($string);
        $string = preg_replace('/_+/', '_', trim($string, '_'));

        return $string;
    }
589175
public function convertNewlines($string) {
        $string = str_replace("\r\n", "\n", $string);
        $string = str_replace("\r", "\n", $string);

        return $this->cleanNewlines($string);
    }
1257077
public function Format($String) {
      $Result = $String;
      foreach ($this->_Formatters as $FArray) {
         $Result = $FArray[0]->Format($Result);
      }
      return $Result;
   }
311450
public function write($string)
    {
        if ($this->isWritable()) {
            $size = $this->getSize();
            $count = fwrite($this->stream, $string);
            $this->setSize($size + $count);
            return $count;
        } else {
            return false;
        }
    }
15862
public static function studlyCase($string) {
    $string = Strings::capitalize(Strings::replace($string, ['/-/', '/_/'], ' '));
    return Strings::replace($string, '/ /');
  }
631357
public static function sentence($string) {
    $pieces = explode(' ', $string);

    // Put the first word into lowercase, unless it's all capitals.
    if (!preg_match('@^[[:upper:]]+$@', $pieces[0])) {
      $pieces[0] = lcfirst($pieces[0]);
    }

    return new StringAssembler($pieces);
  }
545595
public static function strToBool($string)
    {
        if(is_bool($string))
            return $string;

        if (in_array(strtolower((string)$string), array('1', 'true', 'on', '+', 'yes', 'y')))
            return true;
        elseif (in_array(strtolower((string)$string), array('', '0','false', 'off', '-', 'no', 'n')))
            return false;

        return false;
    }