Checks if the given value is a valid number.

@param mixed $value The value that should be validated
@return void
@api
@todo Currency support should be added when it will be supported by NumberParser
420987
protected function isValid($value)
    {
        if (!isset($this->options['locale'])) {
            $locale = $this->localizationService->getConfiguration()->getDefaultLocale();
        } elseif (is_string($this->options['locale'])) {
            $locale = new I18n\Locale($this->options['locale']);
        } elseif ($this->options['locale'] instanceof I18n\Locale) {
            $locale = $this->options['locale'];
        } else {
            $this->addError('The "locale" option can be only set to string identifier, or Locale object.', 1281286579);
            return;
        }

        $strictMode = $this->options['strictMode'];

        $formatLength = $this->options['formatLength'];
        NumbersReader::validateFormatLength($formatLength);

        $formatType = $this->options['formatType'];
        NumbersReader::validateFormatType($formatType);

        if ($formatType === NumbersReader::FORMAT_TYPE_PERCENT) {
            if ($this->numberParser->parsePercentNumber($value, $locale, $formatLength, $strictMode) === false) {
                $this->addError('A valid percent number is expected.', 1281452093);
            }
            return;
        } else {
            if ($this->numberParser->parseDecimalNumber($value, $locale, $formatLength, $strictMode) === false) {
                $this->addError('A valid decimal number is expected.', 1281452094);
            }
        }
    }
634797
public function isValueValid($value) {
		return $value instanceof Type\DistanceType || $value instanceof DataType\NumberType || $value instanceof DataType\TextType;
	}
482889
public function validate($value)
    {
        if ($this->notBeEmpty($value)) {
            $value = json_decode($value);
            if ($value !== null) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
604478
public function isValueValid($value) {
		return $value instanceof DataType\NumberType || $value instanceof Type\PriceSpecificationType || $value instanceof DataType\TextType;
	}
1233806
public function isValid($value)
    {
        if (!is_scalar($value) || !is_numeric($value)) {
            $this->error(self::INVALID);

            return false;
        }

        $length = strlen($value);

        if ($length < 9) {
            $this->error(self::TOO_SHORT);

            return false;
        }

        if ($length > 9) {
            $this->error(self::TOO_LONG);

            return false;
        }

        if (!preg_match($this->pattern, $value, $matches)) {
            $this->error(self::NO_MATCH);

            return false;
        }

        // no digit group can be all 0's
        /** @var array $matches */
        foreach ($matches as $match) {
            if (0 === (int) $match) {
                $this->error(self::NO_MATCH);

                return false;
            }
        }

        // invalid first digit groups 666 or 900-999
        /** @noinspection TypeUnsafeComparisonInspection */
        if ($matches[1] == 666 || $matches[1] >= 900) {
            $this->error(self::NO_MATCH);

            return false;
        }

        // invalid for advertisements
        if ($value >= 987654320 && $value <= 987654329) {
            $this->error(self::NO_MATCH);

            return false;
        }
        // handle famous instance of 1938
        /** @noinspection TypeUnsafeComparisonInspection */
        if ($value == '078051120') {
            $this->error(self::NO_MATCH);

            return false;
        }

        return true;
    }
298000
public function isValid($value)
    {
        $value = (string) $value;
        if (strlen($value) !== 10) {
            $this->_error(self::INVALID_NIP, $value);
            return false;
        }

        $intSum = 0;

        for ($i = 0; $i < 9; $i++) {
            $intSum += $this->_weights[$i] * $value[$i];
        }

        $int = $intSum % 11;
        $intControlNr = ($int === 10) ? 0 : $int;

        if ($intControlNr !== (int) $value[9]) {
            $this->_error(self::INVALID_NIP, $value);
            return false;
        }

        return true;
    }
259770
protected function isValid($value)
    {
        if (is_null($value) || is_float($value) || is_int($value)) {
            return;
        }
        $this->addError('A valid float is expected.', 1514998717);
    }
1236315
protected function validateNumber($value)
    {
        $return = new ValidateResult($value, false);

        if (is_string($value)) {
            //Replace comma with dot
            $value = str_replace(',', '.', $value);
        }

        //Apply all rules
        if (!is_numeric($value) || filter_var($value, FILTER_VALIDATE_FLOAT) === false) {
            //error
            $return->errorObject = new IncorrectParametersException([
                [
                    'type' => static::getType(),
                    'failure' => 'type'
                ]
            ]);
        } elseif ($this->maximum !== null
            && ($value > $this->maximum
                || ($this->exclusiveMaximum === true && $value >= $this->maximum)
            )
        ) {
            //error
            $return->errorObject = new IncorrectParametersException([
                [
                    'type' => static::getType(),
                    'failure' => 'maximum'
                ]
            ]);
        } elseif ($this->minimum !== null
            && ($value < $this->minimum
                || ($this->exclusiveMinimum === true && $value <= $this->minimum)
            )
        ) {
            //error
            $return->errorObject = new IncorrectParametersException([
                [
                    'type' => static::getType(),
                    'failure' => 'minimum'
                ]
            ]);
        } elseif ($this->multipleOf !== null
            && fmod((float)$value, (float)$this->multipleOf) != 0
        ) {
            //error
            $return->errorObject = new IncorrectParametersException([
                [
                    'type' => static::getType(),
                    'failure' => 'multipleOf'
                ]
            ]);
        } else {
            $return->errorObject = null;
            //Set status to success
            $return->status = true;
            //Type cast
            $return->value  = $this->cast($value);
        }

        return $return;
    }
914949
protected function isValid($value)
    {
        $parser = new EelParser($value);
        $result = $parser->match_Expression();

        if ($result === false) {
            $this->addError('Expression "%s" could not be parsed.', 1421940748, [$value]);
        } elseif ($parser->pos !== strlen($value)) {
            $this->addError('Expression "%s" could not be parsed. Error starting at character %d: "%s".', 1421940760, [$value, $parser->pos, substr($value, $parser->pos)]);
        }
    }
1229004
public function isValid($value)
    {
        try {
            if (null === \json_decode($value, true)) {
                return $this->_error(self::INVALID);
            }
        } catch (\Exception $e) {
            return $this->_error(self::INVALID);
        }
        return true;
    }
855694
public function isValid($value)
    {
        foreach ($this as $type) {
            if ($type->isValid($value)) {
                return true;
            }
        }

        return false;
    }
393972
public function isValid($value) {
		if (is_int($value) || is_float($value)) {
			return true;
		}
		
		$this->addMessage('Value must be a digital');
		
		return false;
	}
5120
private function isValidType($value): bool
    {
        if ($this->type instanceof DataType) {
            return $this->type->isTheTypeOf($value);
        }

        return true;
    }
1006280
public function isValid($value)
    {
        if ($value instanceof LocaleCode) {
            $value = LocaleCode::canonicalize($value);
        }

        if (!is_string($value)) {
            $this->error(self::INVALID);
            return false;
        }

        $this->setValue($value);

        if (!in_array($value, $this->getLocaleList(), true)) {
            $this->error(self::NOT_FOUND);
        }

        return count($this->getMessages()) === 0;
    }
849695
public static function isValid($value): bool
    {
        try {
            self::decode($value);

            return true;
        } catch (\Throwable $e) {
            return false;
        }
    }
593835
public function isValueValid($value) {
		return $value instanceof DataType\TextType || $value instanceof Type\ThingType || $value instanceof DataType\URLType;
	}
782286
public function isValid($value)
    {
        $this->_setValue($value);
        $token = $this->getToken();

        if (empty($token)) {
            $this->_error(self::MISSING_TOKEN);
            return false;
        }

        if ($value !== $token) {
            $this->_error(self::NOT_SAME);
            return false;
        }

        return true;
    }