Variable utilities.
More...
Variable utilities.
- Author
- Johannes M. Schmitt schmi.nosp@m.ttjo.nosp@m.h@gma.nosp@m.il.c.nosp@m.om
Definition at line 19 of file VarUtils.php.
◆ __construct()
Assetic\Util\VarUtils::__construct |
( |
| ) |
|
|
finalprivate |
◆ getCombinations()
static Assetic\Util\VarUtils::getCombinations |
( |
array |
$vars, |
|
|
array |
$values |
|
) |
| |
|
static |
Definition at line 50 of file VarUtils.php.
References array.
56 $combinations =
array();
58 foreach ($values as $var => $vals) {
59 if (!in_array($var, $vars,
true)) {
63 $nbValues[$var] = count($vals);
66 for ($i = array_product($nbValues), $c = $i * 2; $i < $c; $i++) {
68 $combination =
array();
70 foreach ($vars as $var) {
71 $combination[$var] = $values[$var][$k % $nbValues[$var]];
72 $k = intval($k / $nbValues[$var]);
75 $combinations[] = $combination;
Create styles array
The data for the language used.
◆ resolve()
static Assetic\Util\VarUtils::resolve |
( |
|
$template, |
|
|
array |
$vars, |
|
|
array |
$values |
|
) |
| |
|
static |
Resolves variable placeholders.
- Parameters
-
string | $template | A template string |
array | $vars | Variable names |
array | $values | Variable values |
- Returns
- string The resolved string
- Exceptions
-
Definition at line 32 of file VarUtils.php.
References array.
Referenced by Assetic\Asset\FileAsset\getLastModified(), Assetic\Asset\GlobAsset\initialize(), Assetic\Asset\HttpAsset\load(), and Assetic\Asset\FileAsset\load().
35 foreach ($vars as $var) {
36 if (
false === strpos($template,
'{'.$var.
'}')) {
40 if (!isset($values[$var])) {
41 throw new \InvalidArgumentException(sprintf(
'The template "%s" contains the variable "%s", but was not given any value for it.', $template, $var));
44 $map[
'{'.$var.
'}'] = $values[$var];
47 return strtr($template, $map);
Create styles array
The data for the language used.
The documentation for this class was generated from the following file:
- libs/composer/vendor/kriswallsmith/assetic/src/Assetic/Util/VarUtils.php