* $engine->render('This is {a} and these are {c.0} and {c.1}', ['a' => 'b', 'c' => ['d', 'e']]); * //Prints "This is b and these are d and e" * */ class Engine extends AbstractEngine { /** * {@inheritdoc} */ public function render($template, $value) { $result = $template; if (!is_array($value)) $value = array('' => $value); foreach (new NestedKeyIterator(new RecursiveArrayOnlyIterator($value)) as $key => $value) { $result = str_replace($this->left . $key . $this->right, $value, $result); } return $result; } }