min = null; $this->max = null; if (is_array($params) && count($params) === 2 && isset($params[0]) && isset($params[1])) { $params = ['min' => min($params), 'max' => max($params)]; } return $params; } public function check(&$value) { $number = $this->toNumber($value); if ($number === false) { return false; } if (! $this->isNot()) { return ($number >= $this->min && $number <= $this->max); } else { return ($number < $this->min || $number > $this->max); } } /** * Default message * @return string */ public function defaultMessage(): string { if (! $this->isNot()) { return _t('error', 'The [attribute] must be between [min] and [max]'); } return _t('error', 'The [attribute] must be less than [min] or more than [max]'); } }