| Total Complexity | 12 |
| Total Lines | 68 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class BelowRule extends AbstractAtomicRule |
||
| 8 | { |
||
| 9 | /** @var string operator */ |
||
| 10 | const operator = '<'; |
||
| 11 | |||
| 12 | /** @var scalar $minimum */ |
||
| 13 | protected $maximum; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @param string $field The field to apply the rule on. |
||
| 17 | * @param array $value The value the field can below to. |
||
| 18 | */ |
||
| 19 | public function __construct( $field, $maximum ) |
||
| 20 | { |
||
| 21 | if ( !is_scalar($maximum) |
||
| 22 | && !$maximum instanceof \DateTimeInterface |
||
| 23 | && null !== $maximum |
||
| 24 | ) { |
||
| 25 | throw new \InvalidArgumentException( |
||
| 26 | "Maximum parameter must be a scalar or null " |
||
| 27 | ."or implements DateTimeInterface instead of: " |
||
| 28 | .var_export($maximum, true) |
||
| 29 | ); |
||
| 30 | } |
||
| 31 | |||
| 32 | $this->field = $field; |
||
| 33 | $this->maximum = $maximum; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Checks if the rule do not expect the value to be above infinity. |
||
| 38 | * |
||
| 39 | * @return bool |
||
| 40 | */ |
||
| 41 | public function hasSolution(array $contextual_options=[]) |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @deprecated getUpperLimit |
||
| 57 | */ |
||
| 58 | public function getMaximum() |
||
| 59 | { |
||
| 60 | return $this->maximum; |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | */ |
||
| 65 | public function getUpperLimit() |
||
| 66 | { |
||
| 67 | return $this->maximum; |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | */ |
||
| 72 | public function getValues() |
||
| 75 | } |
||
| 76 | |||
| 77 | /**/ |
||
| 79 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.