Simplify setPartials nested ifs.

This commit is contained in:
Justin Hileman
2013-03-12 15:29:18 -07:00
parent 32b747be5c
commit 72007e65b4
+4 -4
View File
@@ -241,13 +241,13 @@ class Mustache_Engine
*/ */
public function setPartials(array $partials = array()) public function setPartials(array $partials = array())
{ {
if (isset($this->partialsLoader)) { if (!isset($this->partialsLoader)) {
$this->partialsLoader = new Mustache_Loader_ArrayLoader;
}
if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) { if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) {
throw new Mustache_Exception_RuntimeException('Unable to set partials on an immutable Mustache Loader instance'); throw new Mustache_Exception_RuntimeException('Unable to set partials on an immutable Mustache Loader instance');
} }
} else {
$this->partialsLoader = new Mustache_Loader_ArrayLoader;
}
$this->partialsLoader->setTemplates($partials); $this->partialsLoader->setTemplates($partials);
} }