Evaluates conditions to boolean.
Source
protected static function evaluateCondition($condition)
{
if (is_string($condition)) {
// Should be extended for functions, extensions???
return self::safeClassExists($condition);
}
if (is_callable($condition)) {
return (bool) $condition();
}
if (is_bool($condition)) {
return $condition;
}
if (is_array($condition)) {
foreach ($condition as $c) {
if (\false === static::evaluateCondition($c)) {
// Immediately stop execution if the condition is false
return \false;
}
}
return \true;
}
return \false;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.