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);
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;
static resolve($template, array $vars, array $values)
Resolves variable placeholders.
static getCombinations(array $vars, array $values)
Create styles array
The data for the language used.