Validate the emptiness of a number.

@param mixed $value
@param string $column
@return void
@throws Garp_Model_Validator_Exception
346584
protected function _validateNumber($value, $column) {
        // Not much to check, since 0 is falsy but also a valid integer value.
        if (is_null($value)) {
            throw new Garp_Model_Validator_Exception(
                sprintf(__('%s is a required field'), __(Garp_Util_String::underscoredToReadable($column)))
            );
        }
    }
122070
protected function _setColumns($value)
    {
        $columnMap = [
            1 => 12,
            2 => 6,
            3 => 4,
            4 => 3,
            6 => 2,
            12 => 1,
        ];
        if (!in_array($value, [1, 2, 3, 4, 6, 12])) {
            throw new InvalidArgumentException('Valid columns value must be one of [1, 2, 3, 4, 6, 12]');
        }

        $this->set('columnClass', sprintf('col-md-%d', $columnMap[$value]));

        return $value;
    }
576694
public function validate(string $value)
    {
        if (!$value || $value >= $this->minimumValue) {
            return;
        }

        $this->error['min.%'] = [$this->minimumValue];
    }
1080112
public function validate ($value): void
    {
        switch ($this -> sqlType) {
            case 'ENUM':
            case 'SET':
                // Not implemented;
                break;

            default:
                $common = self::TYPES[$this -> sqlType];
                if (!$this -> size)
                    $this -> size = $common;
                else $this -> size = min($this -> size, $common);
                $this -> getValidator()::apply('strlen', $value, $this -> size);
        }
    }
801741
public function validate($value) {
        if(!is_numeric($value)) {
            throw new DataType('value', 'number', $value);
        }
        
        if($value > $this->max) {
            return new ValidationResult(false, sprintf('Value has to be below %d', $this->max));
        }
        
        return new ValidationResult(true);
    }
588690
public function validate($value)
    {
        $this->pushResult();
        if ($this->acceptsEmptyValues === false || $this->isEmpty($value) === false) {
            $this->isValid($value);
        }
        return $this->popResult();
    }
1226566
protected function _validate_int($value)
    {
        if (is_int($value)) {
            return $value;
        }

        return preg_match('#^[+-]?\d+$#', $value) ? (int)$value : null;
    }
1199272
protected function validate(&$value)
    {
        $validators = $this->getValidators();

        unset($validators['required']);

        // Do not validate if attribute value is not required and empty value is given
        // 'empty' function is not suitable for this check here
        if (!$this->required && (is_null($value) || $value === '')) {
            return;
        }

        $messages = $this->getValidationMessages();

        foreach ($validators as $validator) {
            $this->applyValidator($validator, $this->attribute, $value, $messages);
        }
    }
259770
protected function isValid($value)
    {
        if (is_null($value) || is_float($value) || is_int($value)) {
            return;
        }
        $this->addError('A valid float is expected.', 1514998717);
    }
302997
protected function validate(&$value)
    {
        if ($this->str($value)->contains(',')) {
            $value = $this->str($value)->replace(',', '.')->val();
        }
        $value = floatval($value);

        if (!$this->isNumber($value)) {
            $this->expected('number', gettype($value));
        }

        parent::validate($value);

        return $this;
    }
1186347
public function setColumn(string $column, $value)
    {
        $this->table->getColumn($column);

        $this->columnData[$column] = $value;
    }
225345
public function validate($value)
    {
        try {
            $this->_validate($value);
        } catch (RootException $e) {
            if ($e instanceof ValidationFailedExceptionInterface) {
                throw $e;
            }

            $this->_throwValidationException($this->__('Problem validating'), null, $e, true);
        }
    }
1276189
public function validateValueType($value)
    {
        if ($this->hasOption(Entity\Reflection\Property\Option\Primary::KEY)
            && (Entity\Reflection\Property\Option\Primary::isEmpty($value))
        ) {
            throw new Exception\InvalidArgumentException(
                "Primary value can not be empty string or null!",
                $value
            );
        }

        if ($value === null) {
            return;
        }

        // Enumeration
        if ($this->hasOption(Entity\Reflection\Property\Option\Enum::KEY)
            && !$this->getOption(Entity\Reflection\Property\Option\Enum::KEY)->isValid($value)
        ) {
            throw new Exception\InvalidArgumentException(
                "Value " . $value . " is not from defined entity enumeration "
                . "range on property " . $this->name . "!",
                $value
            );
        }

        // Scalar or array type
        if (self::isScalarType($this->type) || $this->type === self::TYPE_ARRAY) {

            if (gettype($value) === $this->type) {
                return;
            }
            throw new Exception\InvalidArgumentException(
                "Expected " . $this->type . " but " . gettype($value)
                . " given on property " . $this->name . "!",
                $value
            );
        }

        // Object validation
        $givenType = gettype($value);
        if ($givenType === "object") {
            $givenType = get_class($value);
        }

        if ($this->type === self::TYPE_ENTITY) {
            // Entity

            $expectedEntityClass = Convention::nameToClass($this->typeOption, Convention::ENTITY_MASK);
            if ($value instanceof $expectedEntityClass) {
                return;
            } else {
                throw new Exception\InvalidArgumentException(
                    "Expected entity " . $this->typeOption . " but " . $givenType
                    . " given on property " . $this->name . "!",
                    $value
                );
            }
        } elseif ($this->type === self::TYPE_COLLECTION) {
            // Collection

            $entityClass = Convention::nameToClass($this->typeOption, Convention::ENTITY_MASK);
            if (!$value instanceof Entity\Collection) {

                throw new Exception\InvalidArgumentException(
                    "Expected entity collection but " . $givenType . " given on"
                    . " property " . $this->name . "!",
                    $value
                );
            } elseif ($value->getEntityClass() !== $entityClass) {
                throw new Exception\InvalidArgumentException(
                    "Expected collection of entity " . $entityClass
                    . " but collection of entity " . $value->getEntityClass()
                    . " given on property " . $this->name . "!",
                    $value
                );
            } else {
                return;
            }
        } elseif ($this->type === self::TYPE_DATETIME) {
            // DateTime

            if ($value instanceof \DateTime) {
                return;
            } else {
                throw new Exception\InvalidArgumentException(
                    "Expected DateTime but " . $givenType . " given on"
                    . " property " . $this->name . "!",
                    $value
                );
            }
        } elseif ($this->type === self::TYPE_DATE) {
            // Date

            if ($value instanceof \DateTime) {
                return;
            } else {
                throw new Exception\InvalidArgumentException(
                    "Expected date as DateTime object but " . $givenType
                    . " given on property " . $this->name . "!",
                    $value
                );
            }
        } else {
            // Unexpected

            throw new \Exception("Unsupported type " . $this->type . "!");
        }
    }
563562
protected function one($model, $column, $value)
    {
        $object = $model::where($column, '=', $value);

        if (!is_null($object)) {
            if (count($object) > 0) {
                return $object[0];
            }
        }
    }
890311
public function validate($value) {
        if(filter_var($value, FILTER_VALIDATE_INT)===false) {
            return new ValidationResult(false, 'Not a valid integer');
        }        
        return new ValidationResult(true);
    }
619193
public function validate($value)
    {
        $options = array('options' => array(
            'max_range' => $this->max,
            'min_range' => $this->min
        ));

        return empty($value) || (false !== filter_var($value, FILTER_VALIDATE_INT, $options));
    }
508893
protected function validateColumnInRange($column)
    {
        $column = static::validateColumn($column);
        if ($column > $this->columns) {
            throw new Exception('Requested Column exceeds matrix size');
        }

        return $column;
    }