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

doReplacements() public method

Does the replacements in the string for the variable
public doReplacements ( string $value, array $matches, string $type ) : string
$value string The string to parse
$matches array The matches
$type string The variable type
return string The parsed variable
    public function doReplacements($value, $matches, $type)
    {
        $replacements = array();
        for ($i = 0; $i <= count($matches[0]) - 1; $i++) {
            $replacement = $this->fetchVariable($matches[1][$i], $type);
            $replacements[$matches[0][$i]] = $replacement;
        }
        if (!empty($replacements)) {
            $value = strtr($value, $replacements);
        }
        return $value;
    }