Piwik\Validators\

NumberRange

Validator that fails for a non-numeric value or a number outside the optional minimum and maximum.

Methods

The class defines the following methods:

validate()

Validates the given value and throws an exception if it is invalid.

Signature

  • It accepts the following parameter(s):
    • $value (mixed) — The value to validate.
  • It does not return anything or a mixed result.

check()

Lets you easily check a value against multiple validators.

Signature

  • It accepts the following parameter(s):
    • $name (string) — The name/description of the field you want to validate the value for. The name will be prefixed in case there is any error.
    • $value (mixed) — The value which needs to be tested
    • $validators (BaseValidator[]) — The validators to apply, in order.
  • It does not return anything or a mixed result.

__construct()

Signature

  • It accepts the following parameter(s):
    • $min (int|float|null) — The minimum allowed value, or null for no minimum.
    • $max (int|float|null) — The maximum allowed value, or null for no maximum.