| Conditions | 5 |
| Paths | 8 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function __construct($value) |
||
| 17 | { |
||
| 18 | if (is_string($value)) { |
||
| 19 | $value = trim($value); |
||
| 20 | } |
||
| 21 | |||
| 22 | parent::__construct($value); |
||
| 23 | |||
| 24 | if (false !== strpos($value, ';')) { |
||
| 25 | throw new \InvalidArgumentException( |
||
| 26 | "Value for argument $value should not contain semicolons." |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | |||
| 30 | $length = mb_strlen($value); |
||
| 31 | if ($length < 2) { |
||
| 32 | throw new \InvalidArgumentException( |
||
| 33 | "Value for argument $value should not be shorter than 2 chars." |
||
| 34 | ); |
||
| 35 | } |
||
| 36 | |||
| 37 | if ($length > 255) { |
||
| 38 | throw new \InvalidArgumentException( |
||
| 39 | "Value for argument $value should not be longer than 255 chars." |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | } |
||
| 44 |