1 | <?php |
||
5 | class Url |
||
6 | { |
||
7 | /** @var null|string */ |
||
8 | public $scheme; |
||
9 | |||
10 | /** @var null|string */ |
||
11 | public $host; |
||
12 | |||
13 | /** @var int */ |
||
14 | public $port = 80; |
||
15 | |||
16 | /** @var null|string */ |
||
17 | public $path; |
||
18 | |||
19 | /** @var null|string */ |
||
20 | public $query; |
||
21 | |||
22 | /** |
||
23 | * @param string $url |
||
24 | * |
||
25 | * @return static |
||
26 | */ |
||
27 | public static function create(string $url) |
||
31 | |||
32 | public function __construct(string $url) |
||
42 | |||
43 | public function isRelative(): bool |
||
47 | |||
48 | public function isProtocolIndependent(): bool |
||
52 | |||
53 | public function hasCrawlableScheme(): bool |
||
57 | |||
58 | /** |
||
59 | * @param string $scheme |
||
60 | * |
||
61 | * @return $this |
||
62 | */ |
||
63 | public function setScheme(string $scheme) |
||
69 | |||
70 | /** |
||
71 | * @param string $host |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | public function setHost(string $host) |
||
81 | |||
82 | /** |
||
83 | * @param $port |
||
84 | * |
||
85 | * @return $this |
||
86 | */ |
||
87 | public function setPort(int $port) |
||
93 | |||
94 | /** |
||
95 | * @return $this |
||
96 | */ |
||
97 | public function removeFragment() |
||
103 | |||
104 | /** |
||
105 | * @param $path |
||
106 | * |
||
107 | * @return $this |
||
108 | */ |
||
109 | public function setPath(string $path) |
||
115 | |||
116 | /** |
||
117 | * @return null|string |
||
118 | */ |
||
119 | public function path() |
||
123 | |||
124 | /** |
||
125 | * @return null|string |
||
126 | */ |
||
127 | public function directory() |
||
134 | |||
135 | /** |
||
136 | * @param int|null $index |
||
137 | * |
||
138 | * @return array|null|string |
||
139 | */ |
||
140 | public function segments(int $index = null) |
||
155 | |||
156 | /** |
||
157 | * @param int $index |
||
158 | * |
||
159 | * @return string|null |
||
160 | */ |
||
161 | public function segment(int $index) |
||
169 | |||
170 | public function isEqual(Url $otherUrl): bool |
||
174 | |||
175 | /** |
||
176 | * @return string |
||
177 | */ |
||
178 | public function __toString() |
||
188 | |||
189 | /** |
||
190 | * @param string|null $haystack |
||
191 | * @param string|array $needles |
||
192 | * |
||
193 | * @return bool |
||
194 | */ |
||
195 | public function startsWith($haystack, $needles): bool |
||
205 | } |
||
206 |