Commit edda2d41 authored by lucasvanlierop's avatar lucasvanlierop

Reduced nested complexity

parent 59a5f5c0
......@@ -729,20 +729,22 @@ class PostgreSqlPlatform extends AbstractPlatform
return $callback($value ? true : false);
}
if (is_string($value)) {
/**
* 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 (!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);
}
if (in_array(trim(strtolower($value)), $this->booleanLiterals['true'], true)) {
return $callback(true);
}
return $callback(true);
throw new \UnexpectedValueException("Unrecognized boolean literal '${value}'");
}
/**
......
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