Skip to content

Commit

Permalink
Expand complex conditional.
Browse files Browse the repository at this point in the history
Use simpler to read code to check callables.
  • Loading branch information
markstory committed Aug 6, 2015
1 parent e756eaa commit 388940c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Database/Expression/QueryExpression.php
Expand Up @@ -502,13 +502,16 @@ public function __call($method, $args)
*/
public function isCallable($c)
{
return (
!is_string($c) &&
(
(is_array($c) && isset($c[0]) && is_object($c[0]) && is_callable($c)) ||
(is_object($c) && is_callable($c))
)
);
if (is_string($c)) {
return false;
}
if (is_object($c) && is_callable($c)) {
return true;
}
if (is_array($c) && isset($c[0]) && is_object($c[0]) && is_callable($c)) {
return true;
}
return false;
}

/**
Expand Down

0 comments on commit 388940c

Please sign in to comment.