public function Twig_Environment::mergeGlobals in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/lib/Twig/Environment.php \Twig_Environment::mergeGlobals()
Merges a context with the defined globals.
Parameters
array $context An array representing the context:
Return value
array The context merged with the globals
File
- vendor/
twig/ twig/ lib/ Twig/ Environment.php, line 1213
Class
- Twig_Environment
- Stores the Twig configuration.
Code
public function mergeGlobals(array $context) {
// we don't use array_merge as the context being generally
// bigger than globals, this code is faster.
foreach ($this
->getGlobals() as $key => $value) {
if (!array_key_exists($key, $context)) {
$context[$key] = $value;
}
}
return $context;
}