added Twig_Template::hasBlock() method
authorFabien Potencier <fabien.potencier@gmail.com>
Thu, 30 Sep 2010 08:10:16 +0000 (10:10 +0200)
committerFabien Potencier <fabien.potencier@gmail.com>
Thu, 30 Sep 2010 08:10:16 +0000 (10:10 +0200)
lib/Twig/Template.php

index b4b4b92..bbbee48 100644 (file)
@@ -36,11 +36,16 @@ abstract class Twig_Template implements Twig_TemplateInterface
         return $this->env;
     }
 
-    protected function getBlock($name, array $context)
+    public function getBlock($name, array $context)
     {
         return call_user_func($this->blocks[$name][0], $context, array_slice($this->blocks[$name], 1));
     }
 
+    public function hasBlock($name)
+    {
+        return isset($this->blocks[$name][0]);
+    }
+
     protected function getParent($context, $parents)
     {
         return call_user_func($parents[0], $context, array_slice($parents, 1));