| Conditions | 4 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | 8 | public function __construct($minLength, $maxLength) |
|
| 13 | { |
||
| 14 | 8 | $this->message = 'This field does not meet the permitted length.'; |
|
| 15 | |||
| 16 | 8 | if (! is_int($minLength)) { |
|
| 17 | 1 | throw new \InvalidArgumentException( |
|
| 18 | 1 | sprintf('Minimum length must be type of int, %s given.', gettype($minLength)) |
|
| 19 | 1 | ); |
|
| 20 | } |
||
| 21 | |||
| 22 | 7 | if (! is_int($maxLength)) { |
|
| 23 | 1 | throw new \InvalidArgumentException( |
|
| 24 | 1 | sprintf('Maximum length must be type of int, %s given.', gettype($maxLength)) |
|
| 25 | 1 | ); |
|
| 26 | } |
||
| 27 | |||
| 28 | 6 | if ($minLength > $maxLength) { |
|
| 29 | 1 | throw new \InvalidArgumentException('Minimum length must not be greater than maximum length.'); |
|
| 30 | } |
||
| 31 | |||
| 32 | 5 | $this->minLength = $minLength; |
|
| 33 | 5 | $this->maxLength = $maxLength; |
|
| 34 | 5 | } |
|
| 35 | |||
| 41 |