Return true if result is filtered

@param array  $condition Condition
@param mixed  $value     The value
@param string $type      The type of value

@return bool Whether result is filtered
550953
public function isFiltered($condition, $value, $type)
    {
        $isFiltered = true;
        switch ($condition[1]) {
        case '=':
        case '==':
        case 'equal':
            if ($type === 'string' && is_string($value) && is_string($condition[2])) {
                $isFiltered = strcmp($value, $condition[2]) == 0;
            } else {
                $isFiltered = $value == $condition[2];
            }

            break;
        case '!=':
        case 'notEqual':
            if ($type === 'string' && is_string($value) && is_string($condition[2])) {
                $isFiltered = strcmp($value, $condition[2]) != 0;
            } else {
                $isFiltered = $value != $condition[2];
            }

            break;
        case '>':
        case 'gt':
            if ($type === 'string') {
                $isFiltered = strcmp($value, $condition[2]) > 0;
            } else {
                $isFiltered = $value > $condition[2];
            }

            break;
        case '>=':
            if ($type === 'string') {
                $isFiltered = strcmp($value, $condition[2]) >= 0;
            } else {
                $isFiltered = $value >= $condition[2];
            }

            break;
        case '<':
        case 'lt':
            if ($type === 'string') {
                $isFiltered = strcmp($value, $condition[2]) < 0;
            } else {
                $isFiltered = $value < $condition[2];
            }

            break;
        case '<=':
            if ($type === 'string') {
                $isFiltered = strcmp($value, $condition[2]) <= 0;
            } else {
                $isFiltered = $value <= $condition[2];
            }

            break;
        case 'contain':
        case 'contains':
            $isFiltered = strpos(strtolower($value), strtolower($condition[2])) !== false;
            break;
        case 'notContain':
        case 'notContains':
            $isFiltered = strpos(strtolower($value), strtolower($condition[2])) === false;
            break;
        case 'startWith':
        case 'startsWith':
            $isFiltered = strpos(strtolower($value), strtolower($condition[2])) === 0;
            break;
        case 'notStartWith':
        case 'notStartsWith':
            $isFiltered = strpos(strtolower($value), strtolower($condition[2])) !== 0;
            break;
        case 'endWith':
        case 'endsWith':
            $isFiltered = strpos(strrev(strtolower($value)), strrev(strtolower($condition[2]))) === 0;
            break;
        case 'notEndWith':
        case 'notEndsWith':
            $isFiltered = strpos(strrev(strtolower($value)), strrev(strtolower($condition[2]))) !== 0;
            break;
        case 'between':
            $isFiltered = $value > $condition[2] && $value < $condition[3];
            break;
        case 'notBetween':
            $isFiltered = !($value > $condition[2] && $value < $condition[3]);
            break;
        case "in":
            if (!is_array($condition[2])) {
                $condition[2] = array($condition[2]);
            }

            $isFiltered = in_array($value, $condition[2]);
            break;
        case "notIn":
            if (!is_array($condition[2])) {
                $condition[2] = array($condition[2]);
            }

            $isFiltered = !in_array($value, $condition[2]);
            break;
        default:
            break;
        }
        return $isFiltered;
    }
1123046
protected function hasValidValues(array $values, Type $type): bool
    {
        foreach ($values as $value) {
            if (
                null !== $value
                && Type::BUILTIN_TYPE_INT === $type->getBuiltinType()
                && false === filter_var($value, FILTER_VALIDATE_INT)
            ) {
                return false;
            }
        }

        return true;
    }
1104262
public function validate(string $type, $value): bool
    {
        switch ($type) {
            case self::TYPE_NULL:
                return is_null($value);
            case self::TYPE_BOOLEAN:
                return is_bool($value);
            case self::TYPE_INTEGER:
                return is_integer($value);
            case self::TYPE_FLOAT:
                return is_float($value);
            case self::TYPE_STRING:
                return is_string($value);
            case self::TYPE_ARRAY:
                if (!is_array($value)) {
                    return false;
                }
                return $this->isArrayType($value);
            case self::TYPE_OBJECT:
                if (!is_array($value)) {
                    return false;
                }
                return $this->isObjectType($value);
            case self::TYPE_BINARY:
                return is_string($value);
        }

        throw new InvalidValueException("Invalid value type: $type");
    }
621543
private static function _getCondition($value, array $conditions)
    {
        if (empty($value) || empty($conditions)) {
            return false;
        }

        return current(array_intersect(array_keys($value), $conditions));
    }
1022478
public function deleteBy($condition = null)
	{
		if( !is_null($condition) )
		{
			$this->filterBy($condition);
		}
		$matched = $this->load();
		array_each(
			$matched,
			function($model)
			{ /** @var Lib_Model_Db $model */
				$model->delete();
			}
		);
		return !empty($matched);
	}
1051069
public function where($condition, $value = null, $type = null) {
		if (strpos($condition, '||')) {
			$conditions = explode('||', $condition);
			$conditions = array_map('trim', $conditions);
			
			$conditionParts = [];
			
			foreach ($conditions as $condition) {
				list($property, $condition, $valueCond) = $this->_parseCondition($condition);
				if ($valueCond !== '?') {
					$value = is_numeric($valueCond) ? $this->_parseNumeric($valueCond) : $valueCond;
				}

				$conditionParts[] = $this->_buildCondition($property, $condition, $value);
			}
			
			$this->_addCondition([self::MONGO_OR => $conditionParts]);
		} else {
			list($property, $condition, $valueCond) = $this->_parseCondition($condition);
			
			if ($valueCond !== '?') {
				$value = is_numeric($valueCond) ? $this->_parseNumeric($valueCond) : $valueCond;
			}
			
			$mongoCondition = $this->_buildCondition($property, $condition, $value);
			$this->_addCondition($mongoCondition);
		}
		
		return $this;
	}
347903
public function cas($condition, $value = null) {
		if (!is_null($value)) {
			$this->_switchValue = $value;
		}
		if ((is_null($this->_switchCondition) && true === $condition) ||
			(!is_null($this->_switchCondition) && $this->_switchCondition == $condition)) {
			return $this->_switchValue;
		}
		return null;
	}
1298974
public function expect(int $type, $value = null) : bool
    {
        if (!$this->accept($type, $value)) {
            $this->syntaxError('Expected '.Token::getStringRepresentation($type, $value).' got '.$this->getCurrentToken());
        }

        return true;
    }
309192
private function checkType($type, $value)
    {        
        switch($type)
        {
            case 'bool':
            case 'boolean':
                $codeException = (!is_bool($value)) ? 1 : 0;
                break;
            case 'int':
            case 'integer':
                $codeException = (!is_int($value)) ? 1 : 0;
                break;
            case 'string':
                $codeException = (!is_string($value)) ? 1 : 0;
                break;
            case 'not_resource':
                $codeException = (is_resource($value)) ? 2 : 0;
                break;
            default :
                $codeException = 3;
                break;
        }
        
        return $codeException;
    }
1207630
protected function _where($condition, $value = null, $type = null, $bool = true)
    {
        if (count($this->_parts[self::UNION])) {
            // require_once 'Zend/Db/Select/Exception.php';
            throw new Zend_Db_Select_Exception("Invalid use of where clause with " . self::SQL_UNION);
        }

        if ($value !== null) {
            $condition = $this->_adapter->quoteInto($condition, $value, $type);
        }

        $cond = "";
        if ($this->_parts[self::WHERE]) {
            if ($bool === true) {
                $cond = self::SQL_AND . ' ';
            } else {
                $cond = self::SQL_OR . ' ';
            }
        }

        return $cond . "($condition)";
    }
855753
public function match($type, $value = null)
    {
        if ($this->type === $type || (is_array($type) && in_array($this->type, $type))) {
            if (null === $value || $this->value == $value || (is_array($value) && in_array($this->value, $value))) {
                return true;
            }
        }
        return false;
    }
724781
public function expectNext(int $type, $value = null) : bool
    {
        if (!$this->acceptNext($type, $value)) {
	        $this->syntaxError('Expected '.Token::getStringRepresentation($type, $value).' got '.$this->getNextToken());
        }

        return true;
    }
471562
protected function matchType($value, &$filtered)
    {
        $o = $this->options;
        $min = $o['min_range'] ?? null;
        $max = $o['max_range'] ?? null;
        $strict = !($o['unstrict'] ?? false);

        switch ($this->type)
        {
            case Type::BOOL:
                if ($strict && !is_bool($value))
                    return false;
                $filtered = WF::parse_bool($value);
                return true;
            case Type::NUMERIC:
                if (!is_numeric($value))
                    return false;
                $filtered = WF::is_int_val($value) ? (int)$value : (float)$value;
                return $this->numRangeCheck($filtered, $min, $max);
            case Type::FLOAT:
                if ($strict && !is_float($value) && !is_int($value))
                    return false;
                $filtered = filter_var($value, FILTER_VALIDATE_FLOAT);
                return ($filtered !== false) && $this->numRangeCheck($filtered, $min, $max);
            case Type::INT:
                if (!is_int($value) && ($strict || !WF::is_int_val($value)))
                    return false;
                $filtered = (int)$value;
                return $this->numRangeCheck($filtered, $min, $max);
            case Type::STRING:
                if (!is_string($value) && ($strict || !is_scalar($value)))
                    return false;
                $filtered = (string)$value;
                if ($min !== null && strlen($value) < $min)
                    return false;
                if ($max !== null && strlen($value) > $max)
                    return false;
                if (isset($o['regex']) && !preg_match($o['regex'], $value))
                    return false;
                return true;
            case Type::SCALAR:
                return is_scalar($value);
            case Type::RESOURCE:
                return is_resource($value);
            case Type::DATE:
                // Attempt conversion
                if ($value instanceof \IntlCalendar)
                {
                    $value = $value->toDateTime();
                    $filtered = $value;
                }

                if (!($value instanceof \DateTimeInterface))
                {
                    if (!$strict && is_string($value) && !empty($value))
                    {
                        try
                        {
                            $value = new \DateTime($value);
                        }
                        catch (\Exception $e)
                        {
                            return false;
                        }
                    }
                    else
                        return false;

                    $filtered = $value;
                }

                if ($min instanceof \DateTimeInterface && $value < $min)
                    return false;
                if ($max instanceof \DateTimeInterface && $value > $max)
                    return false;
                return true;
            case Type::ARRAY:
                if (!WF::is_array_like($value))
                    return false;
                $filtered = WF::to_array($value);
                return true;
            case Validator::VALIDATE_FILTER:
                $ft = $o['filter'];
                unset($o['filter']);
                if ($ft === FILTER_VALIDATE_BOOLEAN)
                    $o['flags'] = FILTER_NULL_ON_FAILURE;

                $filtered = filter_var($value, $ft, $o);
                if ($ft === FILTER_VALIDATE_BOOLEAN)
                    return !($filtered === null);
                return $filtered !== false;
            case Type::OBJECT:
                if (!is_object($value))
                    return false;

                // Class, subclass or interface?
                if (isset($o['instanceof']) && !is_a($value, $o['instanceof']))
                    return false;

                // Specific class?
                if (isset($o['class']) && get_class($value) !== $o['class'])
                    return false;

                return true;
            default:
                // @codeCoverageIgnoreStart
                return false;
                // @codeCoverageIgnoreEnd
        }
    }
87352
protected function getConditionTypeClass( $condition_type ) {
		if ( ! isset( $this->condition_types[ $condition_type ] ) ) {
			return null;
		}

		return $this->condition_types[ $condition_type ];
	}
874414
public function filter($value)
        {
            // perform trimming according to the specified criteria
            switch($this->type) {
                case "left":
                    $value = ltrim($value, $this->chars);
                    break;
                case "right":
                    $value = rtrim($value,$this->chars);
                    break;
                default:
                    $value = trim($value,$this->chars);
                    break;
            }

            // we're left with the filtered value
            return $value;
        }
783148
function parse_where_type_condition_array(query, type) {
	var predicates = ARRAY(type).map(function(t) {
		if(is.string(t)) {
			return new Predicate("type = $", t);
		}
		if(type instanceof NoPg.Type) {
			return new Predicate("types_id = $", type.$id);
		}
		throw new TypeError("Unknown type: " + util.inspect(t));
	}).valueOf();
	query.where( Predicate.join(predicates, 'OR') );
}
811522
public function setCondition(array $condition)
    {
        if (!isset($condition['function'])) {
            return false;
        }

        $this->conditional_function = $condition['function'];

        if (isset($condition['parameters'])) {
            $this->conditional_parameters = (array) $condition['parameters'];
        }

        if (isset($condition['inverse'])) {
            $this->conditional_inverse = (boolean) $condition['inverse'];
        }
    }