| Total Complexity | 5 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | class Url |
||
| 22 | { |
||
| 23 | const URL_PATH_REGEX = '~^/(?:[^/?#]*)?(?:[^?#]*)(?:\?(?:[^#]*))?~'; |
||
| 24 | |||
| 25 | /** @var string * */ |
||
| 26 | private $url; |
||
| 27 | |||
| 28 | public function __construct(string $url) |
||
| 29 | { |
||
| 30 | $this->ensureIsValidUrl($url); |
||
| 31 | $this->url = $url; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function asString(): string |
||
| 35 | { |
||
| 36 | return $this->url; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function equals(self $other): bool |
||
| 40 | { |
||
| 41 | return $this->asString() === $other->asString(); |
||
| 42 | } |
||
| 43 | |||
| 44 | private function ensureIsValidUrl(string $url) |
||
| 48 | } |
||
| 49 | } |
||
| 50 | } |
||
| 51 |