src/Sulu/Bundle/ResourceBundle/Resource/FilterListBuilder.php
protected function getValue(Condition $condition)
    {
        $value = $condition->getValue();
        $type = $condition->getType();

        switch ($type) {
            case DataTypes::UNDEFINED_TYPE:
            case DataTypes::STRING_TYPE:
            case DataTypes::TAGS_TYPE:
            case DataTypes::AUTO_COMPLETE_TYPE:
                return $value;
            case DataTypes::NUMBER_TYPE:
                if (is_numeric($value)) {
                    return floatval($value);
                }

                throw new ConditionTypeMismatchException($condition->getId(), $value, $type);
            case DataTypes::BOOLEAN_TYPE:
                return $this->getBoolean($value);
            case DataTypes::DATETIME_TYPE:
                try {
                    return new \DateTime($value);
                } catch (\Exception $ex) {
                    throw new ConditionTypeMismatchException($condition->getId(), $value, $type);
                }
            default:
                throw new ConditionTypeMismatchException($condition->getId(), $value, $type);
        }
    }
protected function getValue(Condition $condition)
    {
        $value = $condition->getValue();
        $type = $condition->getType();

        switch ($type) {
            case DataTypes::UNDEFINED_TYPE:
            case DataTypes::STRING_TYPE:
            case DataTypes::TAGS_TYPE:
            case DataTypes::AUTO_COMPLETE_TYPE:
                return $value;
            case DataTypes::NUMBER_TYPE:
                if (is_numeric($value)) {
                    return floatval($value);
                }

                throw new ConditionTypeMismatchException($condition->getId(), $value, $type);
            case DataTypes::BOOLEAN_TYPE:
                return $this->getBoolean($value);
            case DataTypes::DATETIME_TYPE:
                try {
                    return new \DateTime($value);
                } catch (\Exception $ex) {
                    throw new ConditionTypeMismatchException($condition->getId(), $value, $type);
                }
            default:
                throw new ConditionTypeMismatchException($condition->getId(), $value, $type);
        }
    }
protected function getValue ( Condition $ condition ) { $ value = $ condition -> getValue ( ) ; $ type = $ condition -> getType ( ) ; switch ( $ type ) { case DataTypes :: UNDEFINED_TYPE : case DataTypes :: STRING_TYPE : case DataTypes :: TAGS_TYPE : case DataTypes :: AUTO_COMPLETE_TYPE : return $ value ; case DataTypes :: NUMBER_TYPE : if ( is_numeric ( $ value ) ) { return floatval ( $ value ) ; } throw new ConditionTypeMismatchException ( $ condition -> getId ( ) , $ value , $ type ) ; case DataTypes :: BOOLEAN_TYPE : return $ this -> getBoolean ( $ value ) ; case DataTypes :: DATETIME_TYPE : try { return new \ DateTime ( $ value ) ; } catch ( \ Exception $ ex ) { throw new ConditionTypeMismatchException ( $ condition -> getId ( ) , $ value , $ type ) ; } default : throw new ConditionTypeMismatchException ( $ condition -> getId ( ) , $ value , $ type ) ; } }
Parses and returns the value of a condition.

@param Condition $condition

@return mixed

@throws ConditionTypeMismatchException
Parses and returns the value of a condition .