Generic validation method applicable for all schemes.
May modify this URI in order to get it into a compliant form.
111 $chars_sub_delims =
'!$&\'()*+,;=';
112 $chars_gen_delims =
':/?#[]@';
113 $chars_pchar = $chars_sub_delims .
':@';
116 if (!is_null($this->host)) {
118 $this->host = $host_def->validate($this->host,
$config, $context);
119 if ($this->host ===
false) {
130 if (!is_null($this->scheme) && is_null($this->host) || $this->host ===
'') {
134 if (
$def->defaultScheme === $this->scheme) {
135 $this->scheme = null;
140 if (!is_null($this->userinfo)) {
142 $this->userinfo = $encoder->encode($this->userinfo);
146 if (!is_null($this->port)) {
147 if ($this->port < 1 || $this->port > 65535) {
154 if (!is_null($this->host)) {
163 $this->path = $segments_encoder->encode($this->path);
164 } elseif ($this->path !==
'') {
165 if ($this->path[0] ===
'/') {
169 if (strlen($this->path) >= 2 && $this->path[1] ===
'/') {
176 $this->path = $segments_encoder->encode($this->path);
178 } elseif (!is_null($this->scheme)) {
182 $this->path = $segments_encoder->encode($this->path);
188 $c = strpos($this->path,
'/');
191 $segment_nc_encoder->encode(substr($this->path, 0, $c)) .
192 $segments_encoder->encode(substr($this->path, $c));
194 $this->path = $segment_nc_encoder->encode($this->path);
205 if (!is_null($this->query)) {
206 $this->query = $qf_encoder->encode($this->query);
209 if (!is_null($this->fragment)) {
210 $this->fragment = $qf_encoder->encode($this->fragment);
Class that handles operations involving percent-encoding in URIs.
Validates a host according to the IPv4, IPv6 and DNS (future) specifications.