Craig Davis f4c52ac4c9 Initial commit of Markdown Resume
This includes several vendor libraries: Assetic, LessPHP, Mustache,
SmartyPants, Markdown
2012-03-04 10:41:18 -06:00

31 lines
734 B
PHP
Executable File

<?php
namespace Assetic\Util;
/**
* Path Utils.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
abstract class PathUtils
{
public static function resolvePath($path, array $vars, array $values)
{
$map = array();
foreach ($vars as $var) {
if (false === strpos($path, '{'.$var.'}')) {
continue;
}
if (!isset($values[$var])) {
throw new \InvalidArgumentException(sprintf('The path "%s" contains the variable "%s", but was not given any value for it.', $path, $var));
}
$map['{'.$var.'}'] = $values[$var];
}
return strtr($path, $map);
}
private final function __construct() { }
}