Commit edda2d41 authored by lucasvanlierop's avatar lucasvanlierop

Reduced nested complexity

parent 59a5f5c0
......@@ -729,22 +729,24 @@ class PostgreSqlPlatform extends AbstractPlatform
return $callback($value ? true : false);
}
if (is_string($value)) {
if (!is_string($value)) {
return $callback(true);
}
/**
* Better safe than sorry: http://php.net/in_array#106319
*/
if (in_array(trim(strtolower($value)), $this->booleanLiterals['false'], true)) {
return $callback(false);
} elseif (in_array(trim(strtolower($value)), $this->booleanLiterals['true'], true)) {
return $callback(true);
} else {
throw new \UnexpectedValueException("Unrecognized boolean literal '${value}'");
}
}
if (in_array(trim(strtolower($value)), $this->booleanLiterals['true'], true)) {
return $callback(true);
}
throw new \UnexpectedValueException("Unrecognized boolean literal '${value}'");
}
/**
* Converts one or multiple boolean values.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment