protected function Twig_Environment::initOperators

2 calls to Twig_Environment::initOperators()
Twig_Environment::getBinaryOperators in drupal/core/vendor/twig/twig/lib/Twig/Environment.php
Gets the registered binary Operators.
Twig_Environment::getUnaryOperators in drupal/core/vendor/twig/twig/lib/Twig/Environment.php
Gets the registered unary Operators.

File

drupal/core/vendor/twig/twig/lib/Twig/Environment.php, line 1062

Class

Twig_Environment
Stores the Twig configuration.

Code

protected function initOperators() {
  $this->unaryOperators = array();
  $this->binaryOperators = array();
  foreach ($this
    ->getExtensions() as $extension) {
    $operators = $extension
      ->getOperators();
    if (!$operators) {
      continue;
    }
    if (2 !== count($operators)) {
      throw new InvalidArgumentException(sprintf('"%s::getOperators()" does not return a valid operators array.', get_class($extension)));
    }
    $this->unaryOperators = array_merge($this->unaryOperators, $operators[0]);
    $this->binaryOperators = array_merge($this->binaryOperators, $operators[1]);
  }
}