setMax($options['max'] ?? 0); } /** * Get the max option * * @return int|float */ public function getMax(): int|float { return $this->max; } /** * Set the max option * * @param int|float $max * * @return $this */ public function setMax(int|float $max): static { $this->max = $max; return $this; } /** * Check whether the value is less than the maximum * * @param int|float $value * * @return bool */ public function isValid($value): bool { // Reset messages from a previous isValid() call. $this->clearMessages(); if ($this->getMax() <= $value) { $this->addMessage(sprintf( $this->translate("'%s' is not less than '%s'"), $value, $this->getMax() )); return false; } return true; } }