Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
41 | public function __construct($value) |
||
42 | { |
||
43 | $regex = '/^(?:[A-Za-z][0-9A-Za-z\+\-\.]*)?$/'; |
||
44 | |||
45 | if ('' === $value) |
||
46 | { |
||
47 | return; |
||
48 | } |
||
49 | else if (! \is_string($value)) |
||
50 | { |
||
51 | throw new InvalidUriComponentException('URI component "scheme" must be a string'); |
||
52 | } |
||
53 | else if (! \preg_match($regex, $value)) |
||
54 | { |
||
55 | throw new InvalidUriComponentException('Invalid URI component "scheme"'); |
||
56 | } |
||
57 | |||
58 | $this->value = $value; |
||
59 | } |
||
71 |