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);
        }
    }