Returns a variable from the context.
This method is for internal use only and should never be called directly.
This method should not be overriden in a sub-class as this is an implementation detail that has been introduced to optimize variable access for versions of PHP before 5.4. This is not a way to override the way to get a variable value.
array $context The context:
string $item The variable to return from the context:
Boolean $ignoreStrictCheck Whether to ignore the strict variable check or not:
The content of the context variable
Twig_Error_Runtime if the variable does not exist and Twig is running in strict mode
protected final function getContext($context, $item, $ignoreStrictCheck = false) {
if (!array_key_exists($item, $context)) {
if ($ignoreStrictCheck || !$this->env
->isStrictVariables()) {
return null;
}
throw new Twig_Error_Runtime(sprintf('Variable "%s" does not exist', $item));
}
return $context[$item];
}