final protected function Twig_Template::getContext

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.

Parameters

array $context The context:

string $item The variable to return from the context:

Boolean $ignoreStrictCheck Whether to ignore the strict variable check or not:

Return value

The content of the context variable

Throws

Twig_Error_Runtime if the variable does not exist and Twig is running in strict mode

File

drupal/core/vendor/twig/twig/lib/Twig/Template.php, line 300

Class

Twig_Template
Default base class for compiled templates.

Code

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];
}