M1\Vars\Variables\VariableProvider::typeParse PHP Method

typeParse() private method

Parses the string based on the type of variable
private typeParse ( string $value, string $type ) : string
$value string The string to parse
$type string The variable type
return string The parsed variable
    private function typeParse($value, $type)
    {
        $const_str = sprintf('REGEX_%s_SYNTAX', strtoupper($type));
        $regex = constant('\\M1\\Vars\\Variables\\VariableProvider::' . $const_str);
        $matches = $this->fetchVariableMatches($value, $regex);
        if (is_array($matches)) {
            if (count($matches[0]) === 1 && $value === $matches[0][0]) {
                return $this->fetchVariable(trim($matches[1][0]), $type);
            }
            $value = $this->doReplacements($value, $matches, $type);
        }
        return $value;
    }