| 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); |
||
| 56 | 117 | public function __construct($value) |
|
| 57 | { |
||
| 58 | 117 | if ($value === '') { |
|
| 59 | 1 | return; |
|
| 60 | } |
||
| 61 | |||
| 62 | 117 | if (!is_string($value)) { |
|
| 63 | 13 | throw new InvalidUriComponentException('URI component "scheme" must be a string'); |
|
| 64 | } |
||
| 65 | |||
| 66 | 104 | if (!preg_match(self::VALIDATE_REGEX, $value)) { |
|
| 67 | 1 | throw new InvalidUriComponentException('Invalid URI component "scheme"'); |
|
| 68 | } |
||
| 69 | |||
| 70 | // the component is case-insensitive... |
||
| 71 | 104 | $this->value = strtolower($value); |
|
| 72 | } |
||
| 84 |