moved getTemplateClass() to Twig_Environment
authorfabien <fabien@93ef8e89-cb99-4229-a87c-7fa0fa45744b>
Wed, 11 Nov 2009 16:57:23 +0000 (16:57 +0000)
committerfabien <fabien@93ef8e89-cb99-4229-a87c-7fa0fa45744b>
Wed, 11 Nov 2009 16:57:23 +0000 (16:57 +0000)
git-svn-id: http://svn.twig-project.org/trunk@132 93ef8e89-cb99-4229-a87c-7fa0fa45744b

lib/Twig/Compiler.php
lib/Twig/Environment.php
lib/Twig/Loader.php
lib/Twig/LoaderInterface.php

index 8604a6a..aba6004 100644 (file)
@@ -246,6 +246,6 @@ class Twig_Compiler implements Twig_CompilerInterface
 
   public function getTemplateClass($name)
   {
-    return $this->getEnvironment()->getLoader()->getTemplateClass($name);
+    return $this->getEnvironment()->getTemplateClass($name);
   }
 }
index 98eb962..32414f4 100644 (file)
@@ -78,6 +78,18 @@ class Twig_Environment
     $this->trimBlocks = (bool) $bool;
   }
 
+  /**
+   * Gets the template class associated with the given string.
+   *
+   * @param string $name The name for which to calculate the template class name
+   *
+   * @return string The template class name
+   */
+  public function getTemplateClass($name)
+  {
+    return '__TwigTemplate_'.md5($name);
+  }
+
   public function loadTemplate($name)
   {
     if (!$this->runtimeInitialized)
index 2dc0cd3..2433d55 100644 (file)
@@ -59,7 +59,7 @@ abstract class Twig_Loader implements Twig_LoaderInterface
    */
   public function load($name)
   {
-    $cls = $this->getTemplateClass($name);
+    $cls = $this->env->getTemplateClass($name);
 
     if (class_exists($cls, false))
     {
@@ -127,18 +127,6 @@ abstract class Twig_Loader implements Twig_LoaderInterface
     $this->env = $env;
   }
 
-  /**
-   * Gets the template class associated with the given string.
-   *
-   * @param string $name The name for which to calculate the template class name
-   *
-   * @return string The template class name
-   */
-  public function getTemplateClass($name)
-  {
-    return '__TwigTemplate_'.md5($name);
-  }
-
   public function getCacheFilename($name)
   {
     return $this->cache.'/twig_'.md5($name).'.php';
index cd44e32..4682f08 100644 (file)
@@ -33,13 +33,4 @@ interface Twig_LoaderInterface
    * @param Twig_Environment $env A Twig_Environment instance
    */
   public function setEnvironment(Twig_Environment $env);
-
-  /**
-   * Gets the template class associated with the given string.
-   *
-   * @param string $name The name for which to calculate the template class name
-   *
-   * @return string The template class name
-   */
-  public function getTemplateClass($name);
 }