ensureValueIsValid($value); $this->value = $value; } /** * @param int $value * @return void * @throws InvalidValueException */ private function ensureValueIsValid(int $value): void { if ($value < 1 || $value > self::MAX) { throw new InvalidValueException(sprintf( '<%s> does not allow the value <%s>.', static::class, $value )); } } }