public static function resolve($template, array $vars, array $values)
    {
        $map = array();
        foreach ($vars as $var) {
            if (false === strpos($template, '{'.$var.'}')) {
                continue;
            }

            if (!isset($values[$var])) {
                throw new \InvalidArgumentException(sprintf('The template "%s" contains the variable "%s", but was not given any value for it.', $template, $var));
            }

            $map['{'.$var.'}'] = $values[$var];
        }

        return strtr($template, $map);
    }