| Total Complexity | 6 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | #[Attribute(Attribute::TARGET_PROPERTY)] |
||
| 10 | class NumberBetween extends AbstractValidation |
||
| 11 | { |
||
| 12 | const MESSAGE = 'the value should be between `%s` and `%s` (%s inclusive)'; |
||
| 13 | |||
| 14 | public function __construct( |
||
| 15 | private int|float $min, |
||
| 16 | private int|float $max, |
||
| 17 | private $boundaries = true, |
||
| 18 | ?string $message = null |
||
| 19 | ) { |
||
| 20 | $this->message = $message ?? sprintf( |
||
| 21 | self::MESSAGE, |
||
| 22 | $this->min, |
||
| 23 | $this->max, |
||
| 24 | !$this->boundaries ? 'not' : '' |
||
| 25 | ); |
||
| 26 | parent::__construct($message); |
||
| 27 | } |
||
| 28 | |||
| 29 | protected function evaluate($input, array $context = []): bool |
||
| 36 | } |
||
| 37 | } |
||
| 38 |