You are here

protected function Twig_Test_NodeTestCase::getVariableGetter in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Test/NodeTestCase.php \Twig_Test_NodeTestCase::getVariableGetter()
2 calls to Twig_Test_NodeTestCase::getVariableGetter()
Twig_Tests_Node_Expression_GetAttrTest::getTests in vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php
Twig_Tests_Node_Expression_NameTest::getTests in vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php

File

vendor/twig/twig/lib/Twig/Test/NodeTestCase.php, line 45

Class

Twig_Test_NodeTestCase

Code

protected function getVariableGetter($name, $line = false) {
  $line = $line > 0 ? "// line {$line}\n" : '';
  if (PHP_VERSION_ID >= 50400) {
    return sprintf('%s(isset($context["%s"]) ? $context["%s"] : null)', $line, $name, $name);
  }
  return sprintf('%s$this->getContext($context, "%s")', $line, $name);
}