浏览代码

Simplify `setPartials` nested ifs.

Justin Hileman 12 年之前
父节点
当前提交
72007e65b4
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      src/Mustache/Engine.php

+ 5 - 5
src/Mustache/Engine.php

@@ -241,14 +241,14 @@ class Mustache_Engine
      */
     public function setPartials(array $partials = array())
     {
-        if (isset($this->partialsLoader)) {
-            if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) {
-                throw new Mustache_Exception_RuntimeException('Unable to set partials on an immutable Mustache Loader instance');
-            }
-        } else {
+        if (!isset($this->partialsLoader)) {
             $this->partialsLoader = new Mustache_Loader_ArrayLoader;
         }
 
+        if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) {
+            throw new Mustache_Exception_RuntimeException('Unable to set partials on an immutable Mustache Loader instance');
+        }
+
         $this->partialsLoader->setTemplates($partials);
     }