summaryrefslogtreecommitdiffstats
path: root/Mustache/Loader/StringLoader.php
diff options
context:
space:
mode:
authorSimon Rettberg2015-03-02 16:51:04 +0100
committerSimon Rettberg2015-03-02 16:51:04 +0100
commitab23338fe9f1b3ed21455867f1c032d7b146ceb8 (patch)
tree33d27fd848e25ae24a57b309348b5d73a811f223 /Mustache/Loader/StringLoader.php
downloadbwlp-webadmin-ab23338fe9f1b3ed21455867f1c032d7b146ceb8.tar.gz
bwlp-webadmin-ab23338fe9f1b3ed21455867f1c032d7b146ceb8.tar.xz
bwlp-webadmin-ab23338fe9f1b3ed21455867f1c032d7b146ceb8.zip
Initial Commit
Diffstat (limited to 'Mustache/Loader/StringLoader.php')
-rw-r--r--Mustache/Loader/StringLoader.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/Mustache/Loader/StringLoader.php b/Mustache/Loader/StringLoader.php
new file mode 100644
index 0000000..8f18062
--- /dev/null
+++ b/Mustache/Loader/StringLoader.php
@@ -0,0 +1,42 @@
+<?php
+
+/*
+ * This file is part of Mustache.php.
+ *
+ * (c) 2012 Justin Hileman
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Mustache Template string Loader implementation.
+ *
+ * A StringLoader instance is essentially a noop. It simply passes the 'name' argument straight through:
+ *
+ * $loader = new StringLoader;
+ * $tpl = $loader->load('{{ foo }}'); // '{{ foo }}'
+ *
+ * This is the default Template Loader instance used by Mustache:
+ *
+ * $m = new Mustache;
+ * $tpl = $m->loadTemplate('{{ foo }}');
+ * echo $tpl->render(array('foo' => 'bar')); // "bar"
+ *
+ * @implements Loader
+ */
+class Mustache_Loader_StringLoader implements Mustache_Loader
+{
+
+ /**
+ * Load a Template by source.
+ *
+ * @param string $name Mustache Template source
+ *
+ * @return string Mustache Template source
+ */
+ public function load($name)
+ {
+ return $name;
+ }
+}