source: trunk/prototype/library/Assetic/Util/PathUtils.php @ 7575

Revision 7575, 735 bytes checked in by angelo, 12 years ago (diff)

Ticket #3197 - Reduzir tempo de carregamento do modulo Expresso Mail

Line 
1<?php
2
3namespace Assetic\Util;
4
5/**
6 * Path Utils.
7 *
8 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
9 */
10abstract class PathUtils
11{
12    public static function resolvePath($path, array $vars, array $values)
13    {
14        $map = array();
15        foreach ($vars as $var) {
16            if (false === strpos($path, '{'.$var.'}')) {
17                continue;
18            }
19
20            if (!isset($values[$var])) {
21                throw new \InvalidArgumentException(sprintf('The path "%s" contains the variable "%s", but was not given any value for it.', $path, $var));
22            }
23
24            $map['{'.$var.'}'] = $values[$var];
25        }
26
27        return strtr($path, $map);
28    }
29
30    final private function __construct() { }
31}
Note: See TracBrowser for help on using the repository browser.