| Conditions | 6 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function check() |
||
| 26 | { |
||
| 27 | $value = $this->getValue(); |
||
| 28 | if (gettype($value) == 'string') { |
||
| 29 | if ($value != 'auto') { |
||
| 30 | throw new InvalidOptionValueException( |
||
| 31 | 'The "quality" option must be either "auto" or a number between 0-100. ' . |
||
| 32 | 'A string, different from "auto" was given' |
||
| 33 | ); |
||
| 34 | } |
||
| 35 | } elseif (gettype($value) == 'integer') { |
||
| 36 | if (($value < 0) || ($value > 100)) { |
||
| 37 | throw new InvalidOptionValueException( |
||
| 38 | 'The "quality" option must be either "auto" or a number between 0-100. ' . |
||
| 39 | 'The number you provided (' . strval($value) . ') is out of range.' |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | } else { |
||
| 43 | throw new InvalidOptionValueException( |
||
| 44 | 'The "quality" option must be either "auto" or an integer. ' . |
||
| 45 | 'You however provided a value of type: ' . gettype($value) |
||
| 46 | ); |
||
| 50 |