@param string $string

@return array
335360
public function parseFormat($string) {
        $groups = [];

        if (preg_match_all("#(?<!\\\\)<[/]?(\w+)([\sa-z0-9=_;,]*)>#", $string, $matches, PREG_SET_ORDER) !== false) {
            $groups = $matches;
        }

        return $groups;
    }
201631
protected function parse_vars($string)
	{
		foreach ($this->vars as $var => $val)
		{
			$string = str_replace("%$var%", $val, $string);
		}

		return $string;
	}
317306
public static function decode($string)
    {
        if (!$string) {
            return new ArrayObject();
        }

        $array = SymfonyYaml::parse($string);

        if (!is_array($array)) {
            $array = [];
        }

        return ArrayObject::make($array);
    }
100254
private function separateSelectString(string $string)
    {
        if (false === strpos($string, '(')) {
            return array_map('trim', explode(',', $string));
        }

        $opened = $closed = 0;
        $cnt = mb_strlen($string);
        $arrayStrings = [];
        $substring = '';

        for ($i = 0; $i < $cnt; $i++) {
            $substring .= $string[$i];
            if ('(' === $string[$i]) {
                $opened++;
            } elseif (')' === $string[$i]) {
                $closed++;
            } elseif (',' === $string[$i] && $opened === $closed) {
                $arrayStrings[] = trim($substring);
            }
        }
        $arrayStrings[] = trim($substring);

        return $arrayStrings;
    }
560764
public static function fromHeader(string $string): array
    {
        $cookies = \explode(";", $string);
        $result = [];

        try {
            foreach ($cookies as $cookie) {
                $parts = \explode('=', $cookie, 2);

                if (2 !== \count($parts)) {
                    return [];
                }

                list($name, $value) = $parts;

                // We can safely trim quotes, as they're not allowed within cookie values
                $result[] = new self(\trim($name), \trim($value, " \t\""));
            }
        } catch (InvalidCookieException $e) {
            return [];
        }

        return $result;
    }
815556
public static function decode(string $string)
    {
        $content = json_decode($string, true);

        self::throwOnError();

        return $content;
    }
844191
protected function parseManagerId($string)
    {
        list($appId, $workerClass, $managerId) = explode('@', $string);

        return [
            Manager::P_APP_ID       => $appId,
            Manager::P_WORKER_CLASS => $workerClass,
            Manager::P_ID           => $managerId,
        ];
    }
737656
protected function toTokens(string $string = null): array
    {
        if (null === $string) {
            $string = $this->getBodyAsString();
        }

        $tokens = [];
        // Generate atoms; split at all invisible boundaries followed by WSP
        foreach (preg_split('~(?=[ \t])~', $string) as $token) {
            $newTokens = $this->generateTokenLines($token);
            foreach ($newTokens as $newToken) {
                $tokens[] = $newToken;
            }
        }

        return $tokens;
    }
1291231
public function tokenize($string)
    {
        $matches = array();
        $count = preg_match_all($this->pattern, $string, $matches, $this->flags, $this->offset);
        if($count === false) { 
            return array();
        }
        return $matches[0];
        
    }
301194
public static function toArray($string = '')
    {
        if ($string === '') {
            return [];
        }

        if (self::isJson($string)) {
            return json_decode($string, true);
        }

        if (self::isXml($string)) {
            return self::xmlToArray($string);
        }

        $unserialize = self::unserialize($string);
        if ($unserialize === false) {
            return [];
        }

        if (\is_array($unserialize)) {
            return $unserialize;
        }

        return [];

    }
974633
public static function decode($string)
    {
        $xml = simplexml_load_string($string);
        $array = array($xml->getName() => (array) $xml);
        $array = self::loopDecode($array);

        return $array;
    }
376015
public static function parseDsn($string = null)
	{
		$opts = null;

		if (!empty($string)) {
			$dsn = new DSN($string);

			$port = empty($dsn->getFirstPort()) ? '' : (':' . $dsn->getFirstPort());
			$password = empty($dsn->getPassword()) ? null : $dsn->getPassword();

			$opts = [
				'driver'	=> $dsn->getProtocol(),
				'host'		=> $dsn->getFirstHost() . $port,
				'database'	=> $dsn->getDatabase(),
				'username'	=> $dsn->getUsername(),
				'password'	=> $password
			];
		}

		return $opts;
	}
723841
public static function toClass($string)
    {
        if (empty($string)) {
            return null;
        }

        $classnameMatches = [];
        if (preg_match('/^([a-zA-Z_]{1}[a-zA-Z0-9_\\\\]*)\.class/', $string, $classnameMatches) != false) {
            return new \ReflectionClass($classnameMatches[1]);
        }

        return null;
    }
1036165
public static function stringToArray($string)
    {
        if (!preg_match("@^{.*?}$@", $string)) {
            return $string;
        }
        $parts = explode(',', substr($string, 1, -1));
        foreach ($parts as &$part) {
            $part = self::stringToArray($part);
        }
        return $parts;
    }
653073
private function unwrap(string &$string): array
    {
        if (
            !$this->unaChecked
            &&
            \strpos($string, 'UNA') === 0
        ) {
            $this->analyseUNA(
                \substr(\substr($string, 3), 0, 9)
            );
        }

        if (
            !$this->unbChecked
            &&
            \strpos($string, 'UNB') === 0
        ) {
            $this->analyseUNB(
                \preg_replace(
                    "#^UNB\+#",
                    '',
                    \substr($string, 0, 8)
                )
            );
        }

        $string = \preg_replace(
            "/(([^" . $this->symbRel . "]" . $this->symbRel . "{2})+|[^" . $this->symbRel . "])" . $this->symbEnd . "/",
            "$1" . $this->stringSafe,
            $string
        );

        $file = \preg_split(
            self::$DELIMITER . $this->stringSafe . self::$DELIMITER . "i",
            $string
        );
        // fallback
        if ($file === false) {
            $file = [];
        }

        $end = \stripslashes($this->symbEnd);
        foreach ($file as $fc => &$line) {
            if (\trim($line) == '') {
                /* @noinspection OffsetOperationsInspection */
                unset($file[$fc]);
            }
            $line .= $end;
        }

        return $file;
    }
66870
protected function decodeConfiguration($string)
    {
        $config = [];
        $directives = explode($this->directiveSeparator, $string);
        foreach ($directives as $directive) {
            $parts = array_filter(explode($this->sourceSeparator, $directive));
            $key = trim(array_shift($parts));
            $config[$key] = $parts;
        }

        return $config;
    }
1225386
private function prepareForCasing($string): array
    {
        $string = str_replace(['.', '_', '-'], ' ', $string);

        // split on capital letters
        $string = implode(' ', preg_split('/(?<=\\w)(?=[A-Z])/', $string));

        // explode on numbers
        $parts = preg_split('/(,?\s+)|((?<=[a-z])(?=\d))|((?<=\d)(?=[a-z]))/i', $string);

        // return only words
        return array_values(array_filter($parts, function ($value) {
            return !empty($value);
        }));
    }