1 | <?php |
||
5 | class Url |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | protected $scheme; |
||
11 | |||
12 | const SCHEME_HTTP = 'http'; |
||
13 | const SCHEME_HTTPS = 'https'; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $hostName; |
||
19 | |||
20 | /** |
||
21 | * @var int |
||
22 | */ |
||
23 | protected $port; |
||
24 | |||
25 | const PORT_HTTP = 80; |
||
26 | const PORT_HTTPS = 443; |
||
27 | |||
28 | /** |
||
29 | * @var string|null |
||
30 | */ |
||
31 | protected $user; |
||
32 | |||
33 | /** |
||
34 | * @var string|null |
||
35 | */ |
||
36 | protected $password; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $path; |
||
42 | |||
43 | /** |
||
44 | * @var string|null |
||
45 | */ |
||
46 | protected $query; |
||
47 | |||
48 | /** |
||
49 | * @var string|null |
||
50 | */ |
||
51 | protected $fragment; |
||
52 | |||
53 | /** |
||
54 | * @param string $url |
||
55 | */ |
||
56 | public function __construct($url) |
||
66 | |||
67 | /** |
||
68 | * @param array $urlParts |
||
69 | */ |
||
70 | protected function setUrlParts(array $urlParts) |
||
89 | |||
90 | /** |
||
91 | * @param array $urlParts |
||
92 | * @param string $partName |
||
93 | * @param \Closure|string|int|null $default |
||
94 | * @param string|null $property |
||
95 | */ |
||
96 | protected function setUrlPart($urlParts, $partName, $default = null, $property = null) |
||
112 | |||
113 | /** |
||
114 | * @return string |
||
115 | */ |
||
116 | public function getScheme() |
||
120 | |||
121 | /** |
||
122 | * @return string |
||
123 | */ |
||
124 | public function getHostName() |
||
128 | |||
129 | /** |
||
130 | * @return int |
||
131 | */ |
||
132 | public function getPort() |
||
136 | |||
137 | /** |
||
138 | * @return string|null |
||
139 | */ |
||
140 | public function getUser() |
||
144 | |||
145 | /** |
||
146 | * @return string|null |
||
147 | */ |
||
148 | public function getPassword() |
||
152 | |||
153 | /** |
||
154 | * @return string |
||
155 | */ |
||
156 | public function getPath() |
||
160 | |||
161 | /** |
||
162 | * @return string|null |
||
163 | */ |
||
164 | public function getQuery() |
||
168 | |||
169 | /** |
||
170 | * @return string|null |
||
171 | */ |
||
172 | public function getFragment() |
||
176 | |||
177 | /** |
||
178 | * @return string |
||
179 | */ |
||
180 | public function getHost() |
||
191 | |||
192 | /** |
||
193 | * @return string |
||
194 | */ |
||
195 | public function getResource() |
||
207 | |||
208 | /** |
||
209 | * @return string |
||
210 | */ |
||
211 | public function __toString() |
||
215 | } |
||
216 |