public function __getCondition($value)
{
if ($value === '' || $value === NULL) {
return FALSE;
//skip
}
$condition = $this->getCondition();
if ($this->where !== NULL) {
$condition = Condition::setupFromCallback($this->where, $value);
} elseif (is_string($condition)) {
$condition = Condition::setup($this->getColumn(), $condition, $this->formatValue($value));
} elseif (is_callable($condition)) {
$condition = call_user_func_array($condition, [$value]);
} elseif (is_array($condition)) {
$condition = isset($condition[$value]) ? $condition[$value] : Condition::setupEmpty();
}
if (is_array($condition)) {
//for user-defined condition by array or callback
$condition = Condition::setupFromArray($condition);
} elseif ($condition !== NULL && !$condition instanceof Condition) {
$type = gettype($condition);
throw new Exception("Condition must be array or Condition object. {$type} given.");
}
return $condition;
}