1 | <?php |
||
22 | final class Uri |
||
23 | { |
||
24 | /** |
||
25 | * Uri path. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | private $uri; |
||
30 | |||
31 | /** |
||
32 | * Initializes the Uri. |
||
33 | * |
||
34 | * @param string $uri |
||
35 | * @throws \InvalidArgumentException |
||
36 | */ |
||
37 | 4 | public function __construct($uri) |
|
47 | |||
48 | /** |
||
49 | * Returns a string representation of the uri. |
||
50 | * |
||
51 | * @return string |
||
52 | */ |
||
53 | 2 | public function __toString() |
|
57 | |||
58 | /** |
||
59 | * Checks if the provided uri is equal to the current uri. |
||
60 | * |
||
61 | * @param Uri $other |
||
62 | */ |
||
63 | 2 | public function equals($other): bool |
|
67 | |||
68 | /** |
||
69 | * Checks if $uri is of type string. |
||
70 | * |
||
71 | * @param string $uri |
||
72 | * |
||
73 | * @throws \InvalidArgumentException if $uri is not a string. |
||
74 | */ |
||
75 | 7 | private function validateString($uri) |
|
81 | |||
82 | /** |
||
83 | * Checks if $uri is valid. |
||
84 | * |
||
85 | * @param string $uri |
||
86 | * |
||
87 | * @throws \InvalidArgumentException if $uri is not a valid uri. |
||
88 | */ |
||
89 | 6 | private function validateUri($uri) |
|
95 | |||
96 | /** |
||
97 | * Checks if a scheme is present. |
||
98 | * If no scheme is found, it is assumed that a local path is used, and file:// is prepended. |
||
99 | * |
||
100 | * @param string $uri |
||
101 | */ |
||
102 | 6 | private function addFileSchemeWhenSchemeIsAbsent($uri): string |
|
114 | } |
||
115 |