Permalink
Browse files

Simplify `setPartials` nested ifs.

  • Loading branch information...
1 parent 32b747b commit 72007e65b439c5f915291674ea4f8614e297e669 @bobthecow committed Mar 12, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/Mustache/Engine.php
View
@@ -241,14 +241,14 @@ public function getPartialsLoader()
*/
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);
}

0 comments on commit 72007e6

Please sign in to comment.