Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ExtensionSet.php

function ExtensionSet::getTest

File

vendor/twig/twig/src/ExtensionSet.php, line 366

Class

ExtensionSet
@author Fabien Potencier <fabien@symfony.com>

Namespace

Twig

Code

public function getTest(string $name) : ?TwigTest {
    if (!$this->initialized) {
        $this->initExtensions();
    }
    if (isset($this->tests[$name])) {
        return $this->tests[$name];
    }
    foreach ($this->dynamicTests as $pattern => $test) {
        if (preg_match($pattern, $name, $matches)) {
            array_shift($matches);
            return $test->withDynamicArguments($name, $test->getName(), $matches);
        }
    }
    return null;
}
RSS feed
Powered by Drupal