You are here

public function Twig_Parser::isReservedMacroName in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Parser.php \Twig_Parser::isReservedMacroName()
1 call to Twig_Parser::isReservedMacroName()
Twig_Parser::setMacro in vendor/twig/twig/lib/Twig/Parser.php

File

vendor/twig/twig/lib/Twig/Parser.php, line 259

Class

Twig_Parser
Default parser implementation.

Code

public function isReservedMacroName($name) {
  if (null === $this->reservedMacroNames) {
    $this->reservedMacroNames = array();
    $r = new ReflectionClass($this->env
      ->getBaseTemplateClass());
    foreach ($r
      ->getMethods() as $method) {
      $methodName = strtolower($method
        ->getName());
      if ('get' === substr($methodName, 0, 3) && isset($methodName[3])) {
        $this->reservedMacroNames[] = substr($methodName, 3);
      }
    }
  }
  return in_array(strtolower($name), $this->reservedMacroNames);
}