mirror of
https://github.com/there4/markdown-resume.git
synced 2024-12-03 08:59:35 -05:00
This includes several vendor libraries: Assetic, LessPHP, Mustache, SmartyPants, Markdown
31 lines
734 B
PHP
Executable File
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() { }
|
|
} |