Explorar el Código

Avoid indentomatic with long filter chains.

Justin Hileman hace 13 años
padre
commit
242e94c91b
Se han modificado 1 ficheros con 3 adiciones y 4 borrados
  1. 3 4
      src/Mustache/Compiler.php

+ 3 - 4
src/Mustache/Compiler.php

@@ -315,11 +315,10 @@ class Mustache_Compiler
 
     const FILTER = '
         $filter = $context->%s(%s);
-        if (!is_string($filter) && is_callable($filter)) {
-            $value = call_user_func($filter, $value);%s
-        } else {
+        if (is_string($filter) || !is_callable($filter)) {
             throw new UnexpectedValueException(%s);
         }
+        $value = call_user_func($filter, $value);%s
     ';
 
     /**
@@ -341,7 +340,7 @@ class Mustache_Compiler
         $filter = ($method !== 'last') ? var_export($name, true) : '';
         $msg    = var_export(sprintf('Filter not found: %s', $name), true);
 
-        return sprintf($this->prepare(self::FILTER, $level), $method, $filter, $this->getFilter($filters, $level + 1), $msg);
+        return sprintf($this->prepare(self::FILTER, $level), $method, $filter, $msg, $this->getFilter($filters, $level));
     }
 
     const LINE = '$buffer .= "\n";';