Revision 7575,
735 bytes
checked in by angelo, 12 years ago
(diff) |
Ticket #3197 - Reduzir tempo de carregamento do modulo Expresso Mail
|
Rev | Line | |
---|
[7575] | 1 | <?php |
---|
| 2 | |
---|
| 3 | namespace Assetic\Util; |
---|
| 4 | |
---|
| 5 | /** |
---|
| 6 | * Path Utils. |
---|
| 7 | * |
---|
| 8 | * @author Johannes M. Schmitt <schmittjoh@gmail.com> |
---|
| 9 | */ |
---|
| 10 | abstract 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.