We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 3 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 66.67% |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | final class Between extends AbstractRule |
||
| 27 | { |
||
| 28 | use ComparisonHelper; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var mixed |
||
| 32 | */ |
||
| 33 | private $minimum; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var mixed |
||
| 37 | */ |
||
| 38 | private $maximum; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @var bool |
||
| 42 | */ |
||
| 43 | private $inclusive; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Initializes the rule. |
||
| 47 | * |
||
| 48 | * @param mixed $minimum |
||
| 49 | * @param mixed $maximum |
||
| 50 | * @param bool $inclusive |
||
| 51 | * |
||
| 52 | * @throws ComponentException |
||
| 53 | */ |
||
| 54 | 2 | public function __construct($minimum, $maximum, bool $inclusive = true) |
|
| 55 | { |
||
| 56 | 2 | if ($this->toComparable($minimum) >= $this->toComparable($maximum)) { |
|
| 57 | 2 | throw new ComponentException(stringify($minimum).' cannot be less than or equals to '.stringify($maximum)); |
|
| 58 | } |
||
| 59 | |||
| 60 | $this->minimum = $minimum; |
||
| 61 | $this->maximum = $maximum; |
||
| 62 | $this->inclusive = $inclusive; |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * {@inheritdoc} |
||
| 67 | */ |
||
| 68 | 19 | public function validate($input): bool |
|
| 76 | } |
||
| 77 | } |
||
| 78 |