Same name and namespace in other branches
  1. 8.9.x core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php \Drupal\twig_loader_test\Loader\TestLoader
  2. 9 core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php \Drupal\twig_loader_test\Loader\TestLoader

A test Twig loader.

Hierarchy

Expanded class hierarchy of TestLoader

1 string reference to 'TestLoader'
twig_loader_test.services.yml in core/modules/system/tests/modules/twig_loader_test/twig_loader_test.services.yml
core/modules/system/tests/modules/twig_loader_test/twig_loader_test.services.yml
1 service uses TestLoader
twig_loader_test.twig.test_loader in core/modules/system/tests/modules/twig_loader_test/twig_loader_test.services.yml
Drupal\twig_loader_test\Loader\TestLoader

File

core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php, line 11

Namespace

Drupal\twig_loader_test\Loader
View source
class TestLoader implements LoaderInterface {

  /**
   * {@inheritdoc}
   */
  public function getSourceContext(string $name) : Source {
    $name = (string) $name;
    $value = $name === 'kittens' ? 'kittens' : 'cats';
    return new Source($value, $name);
  }

  /**
   * {@inheritdoc}
   */
  public function exists(string $name) {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheKey(string $name) : string {
    return $name;
  }

  /**
   * {@inheritdoc}
   */
  public function isFresh(string $name, int $time) : bool {
    return TRUE;
  }

}

Members