| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 34 | 113 | public function __construct($value) |
|
| 35 | { |
||
| 36 | 113 | if ($value === '') { |
|
| 37 | 1 | return; |
|
| 38 | } |
||
| 39 | |||
| 40 | 113 | if (!is_string($value)) { |
|
| 41 | 13 | throw new InvalidArgumentException('URI component "scheme" must be a string'); |
|
| 42 | } |
||
| 43 | |||
| 44 | 100 | if (!preg_match(self::VALIDATION_REGEX, $value)) { |
|
| 45 | 1 | throw new InvalidArgumentException('Invalid URI component "scheme"'); |
|
| 46 | } |
||
| 47 | |||
| 48 | // the component is case-insensitive... |
||
| 49 | 100 | $this->value = strtolower($value); |
|
| 50 | } |
||
| 62 |