| Total Complexity | 9 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class IntegerOption extends Option |
||
| 16 | { |
||
| 17 | |||
| 18 | protected $minValue; |
||
| 19 | protected $maxValue; |
||
| 20 | |||
| 21 | public function __construct($id, $defaultValue, $minValue = null, $maxValue = null) |
||
| 26 | } |
||
| 27 | |||
| 28 | protected function checkMin() |
||
| 29 | { |
||
| 30 | if (!is_null($this->minValue) && $this->getValue() < $this->minValue) { |
||
| 31 | throw new InvalidOptionValueException( |
||
| 32 | '"' . $this->id . '" option must be set to minimum ' . $this->minValue . '. ' . |
||
| 33 | 'It was however set to: ' . $this->getValue() |
||
| 34 | ); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | protected function checkMax() |
||
| 39 | { |
||
| 40 | if (!is_null($this->maxValue) && $this->getValue() > $this->maxValue) { |
||
| 41 | throw new InvalidOptionValueException( |
||
| 42 | '"' . $this->id . '" option must be set to max ' . $this->maxValue . '. ' . |
||
| 43 | 'It was however set to: ' . $this->getValue() |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | protected function checkMinMax() |
||
| 52 | } |
||
| 53 | |||
| 54 | public function check() |
||
| 58 | } |
||
| 59 | } |
||
| 60 |