1 | <?php |
||
9 | class Url implements ValueObjectInterface |
||
10 | { |
||
11 | /** @var SchemeName */ |
||
12 | protected $scheme; |
||
13 | |||
14 | /** @var StringLiteral */ |
||
15 | protected $user; |
||
16 | |||
17 | /** @var StringLiteral */ |
||
18 | protected $password; |
||
19 | |||
20 | /** @var Domain */ |
||
21 | protected $domain; |
||
22 | |||
23 | /** @var Path */ |
||
24 | protected $path; |
||
25 | |||
26 | /** @var PortNumberInterface */ |
||
27 | protected $port; |
||
28 | |||
29 | /** @var QueryString */ |
||
30 | protected $queryString; |
||
31 | |||
32 | /** @var FragmentIdentifier */ |
||
33 | protected $fragmentIdentifier; |
||
34 | |||
35 | /** |
||
36 | * Returns a new Url object from a native url string |
||
37 | * |
||
38 | * @param $url_string |
||
39 | * @return Url |
||
40 | */ |
||
41 | 2 | public static function fromNative() |
|
63 | |||
64 | /** |
||
65 | * Returns a new Url object |
||
66 | * |
||
67 | * @param SchemeName $scheme |
||
68 | * @param StringLiteral $user |
||
69 | * @param StringLiteral $password |
||
70 | * @param Domain $domain |
||
71 | * @param Path $path |
||
72 | * @param PortNumberInterface $port |
||
73 | * @param QueryString $query |
||
74 | * @param FragmentIdentifier $fragment |
||
75 | */ |
||
76 | 13 | public function __construct(SchemeName $scheme, StringLiteral $user, StringLiteral $password, Domain $domain, PortNumberInterface $port, Path $path, QueryString $query, FragmentIdentifier $fragment) |
|
87 | |||
88 | /** |
||
89 | * Tells whether two Url are sameValueAs by comparing their components |
||
90 | * |
||
91 | * @param ValueObjectInterface $url |
||
92 | * @return bool |
||
93 | */ |
||
94 | 2 | public function sameValueAs(ValueObjectInterface $url) |
|
110 | |||
111 | /** |
||
112 | * Returns the domain of the Url |
||
113 | * |
||
114 | * @return Hostname|IPAddress |
||
115 | */ |
||
116 | 6 | public function getDomain() |
|
120 | |||
121 | /** |
||
122 | * Returns the fragment identifier of the Url |
||
123 | * |
||
124 | * @return FragmentIdentifier |
||
125 | */ |
||
126 | 6 | public function getFragmentIdentifier() |
|
130 | |||
131 | /** |
||
132 | * Returns the password part of the Url |
||
133 | * |
||
134 | * @return StringLiteral |
||
135 | */ |
||
136 | 5 | public function getPassword() |
|
140 | |||
141 | /** |
||
142 | * Returns the path of the Url |
||
143 | * |
||
144 | * @return Path |
||
145 | */ |
||
146 | 6 | public function getPath() |
|
150 | |||
151 | /** |
||
152 | * Returns the port of the Url |
||
153 | * |
||
154 | * @return PortNumberInterface |
||
155 | */ |
||
156 | 6 | public function getPort() |
|
160 | |||
161 | /** |
||
162 | * Returns the query string of the Url |
||
163 | * |
||
164 | * @return QueryString |
||
165 | */ |
||
166 | 6 | public function getQueryString() |
|
170 | |||
171 | /** |
||
172 | * Returns the scheme of the Url |
||
173 | * |
||
174 | * @return SchemeName |
||
175 | */ |
||
176 | 6 | public function getScheme() |
|
180 | |||
181 | /** |
||
182 | * Returns the user part of the Url |
||
183 | * |
||
184 | * @return StringLiteral |
||
185 | */ |
||
186 | 6 | public function getUser() |
|
190 | |||
191 | /** |
||
192 | * Returns a string representation of the url |
||
193 | * |
||
194 | * @return string |
||
195 | */ |
||
196 | 4 | public function __toString() |
|
216 | } |
||
217 |