| Total Complexity | 4 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class Between implements ValidateRuleInterface |
||
| 6 | { |
||
| 7 | /** @var int */ |
||
| 8 | protected $min; |
||
| 9 | |||
| 10 | /** @var int */ |
||
| 11 | protected $max; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @param int $min minimum 'floor' value |
||
| 15 | * @param int $max maximum 'ceiling' value |
||
| 16 | */ |
||
| 17 | 27 | public function __construct(int $min, int $max) |
|
| 18 | { |
||
| 19 | 27 | $this->min = $min; |
|
| 20 | 27 | $this->max = $max; |
|
| 21 | 27 | } |
|
| 22 | |||
| 23 | /** |
||
| 24 | * Validates that a field's value is between the given min and max. |
||
| 25 | * |
||
| 26 | * @param $subject |
||
| 27 | * @param string $field |
||
| 28 | * |
||
| 29 | * @return bool |
||
| 30 | */ |
||
| 31 | 27 | public function __invoke($subject, string $field): bool |
|
| 39 | } |
||
| 40 | } |
||
| 41 |