source: sandbox/newExpressoMail/newExpressoMail/Assetic/Util/PathUtils.php @ 7265

Revision 7265, 735 bytes checked in by gustavo, 12 years ago (diff)

Ticket #0000 - Criado novo modulo para o desenvolvimento do novo ExpressoMail?

  • Property svn:executable set to *
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.