Version 1
[yaffs-website] / web / core / modules / system / tests / modules / twig_loader_test / src / Loader / TestLoader.php
diff --git a/web/core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php b/web/core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php
new file mode 100644 (file)
index 0000000..7937daa
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+namespace Drupal\twig_loader_test\Loader;
+
+/**
+ * A test Twig loader.
+ */
+class TestLoader implements \Twig_LoaderInterface, \Twig_ExistsLoaderInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getSource($name) {
+    if ($name == 'kittens') {
+      return $name;
+    }
+    else {
+      return 'cats';
+    }
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function exists($name) {
+    return TRUE;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getCacheKey($name) {
+    return $name;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isFresh($name, $time) {
+    return TRUE;
+  }
+
+}