public function replaceVariables($pattern, $string, $replace)
    {
        $count = preg_match($pattern, $string, $result);

        for ($i = 0; $i < $count; $i += 2) {
            $string = str_replace($result[$i], $this->getVariable($result[$i + 1]), $string);
        }

        return $string;
    }