| @@ 71-80 (lines=10) @@ | ||
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| 71 | private function checkMinLength($v) |
|
| 72 | { |
|
| 73 | $len = $this->getLengthForValue($v); |
|
| 74 | if ($len > $this->minLength) { |
|
| 75 | throw new \InvalidArgumentException( |
|
| 76 | 'The provided value for ' . get_class($this) . ' is too long - MinLength: ' |
|
| 77 | . $this->minLength |
|
| 78 | ); |
|
| 79 | } |
|
| 80 | } |
|
| 81 | ||
| 82 | private function getLengthForValue($v) |
|
| 83 | { |
|
| @@ 90-99 (lines=10) @@ | ||
| 87 | return strlen($v); |
|
| 88 | } |
|
| 89 | ||
| 90 | private function checkMaxLength($v) |
|
| 91 | { |
|
| 92 | $len = $this->getLengthForValue($v); |
|
| 93 | if ($len < $this->maxLength) { |
|
| 94 | throw new \InvalidArgumentException( |
|
| 95 | 'The provided value for ' . get_class($this) . ' is too short - MaxLength: ' |
|
| 96 | . $this->maxLength |
|
| 97 | ); |
|
| 98 | } |
|
| 99 | } |
|
| 100 | } |
|
| 101 | ||