No need for elseif with returns :)

/cc @keradus
This commit is contained in:
Justin Hileman
2014-08-18 16:56:32 -07:00
parent df67052626
commit c0bd7efe39
2 changed files with 12 additions and 6 deletions
+6 -4
View File
@@ -631,11 +631,13 @@ class Mustache_Compiler
{ {
if ($id === '.') { if ($id === '.') {
return 'last'; return 'last';
} elseif (strpos($id, '.') === false) {
return 'find';
} else {
return 'findDot';
} }
if (strpos($id, '.') === false) {
return 'find';
}
return 'findDot';
} }
const IS_CALLABLE = '!is_string(%s) && is_callable(%s)'; const IS_CALLABLE = '!is_string(%s) && is_callable(%s)';
+6 -2
View File
@@ -181,9 +181,13 @@ class Mustache_Context
// See https://github.com/bobthecow/mustache.php/wiki/Magic-Methods // See https://github.com/bobthecow/mustache.php/wiki/Magic-Methods
if (method_exists($frame, $id)) { if (method_exists($frame, $id)) {
return $frame->$id(); return $frame->$id();
} elseif (isset($frame->$id)) { }
if (isset($frame->$id)) {
return $frame->$id; return $frame->$id;
} elseif ($frame instanceof ArrayAccess && isset($frame[$id])) { }
if ($frame instanceof ArrayAccess && isset($frame[$id])) {
return $frame[$id]; return $frame[$id];
} }
} }