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);
    }
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);
    }
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 ) ; }
Resolves variable placeholders.

@param string $template A template string
@param array  $vars     Variable names
@param array  $values   Variable values

@return string The resolved string

@throws \InvalidArgumentException If there is a variable with no value
Resolves variable placeholders .