Generic validation method applicable for all schemes.
May modify this URI in order to get it into a compliant form.
109 $chars_sub_delims =
'!$&\'()*+,;=';
110 $chars_gen_delims =
':/?#[]@';
111 $chars_pchar = $chars_sub_delims .
':@';
114 if (!is_null($this->host)) {
116 $this->host = $host_def->validate($this->host, $config, $context);
117 if ($this->host ===
false) {
128 if (!is_null($this->scheme) && is_null($this->host) || $this->host ===
'') {
131 $def = $config->getDefinition(
'URI');
132 if ($def->defaultScheme === $this->scheme) {
133 $this->scheme = null;
138 if (!is_null($this->userinfo)) {
140 $this->userinfo = $encoder->encode($this->userinfo);
144 if (!is_null($this->port)) {
145 if ($this->port < 1 || $this->port > 65535) {
152 if (!is_null($this->host)) {
161 $this->path = $segments_encoder->encode($this->path);
162 } elseif ($this->path !==
'') {
163 if ($this->path[0] ===
'/') {
167 if (strlen($this->path) >= 2 && $this->path[1] ===
'/') {
174 $this->path = $segments_encoder->encode($this->path);
176 } elseif (!is_null($this->scheme)) {
180 $this->path = $segments_encoder->encode($this->path);
186 $c = strpos($this->path,
'/');
189 $segment_nc_encoder->encode(substr($this->path, 0, $c)) .
190 $segments_encoder->encode(substr($this->path, $c));
192 $this->path = $segment_nc_encoder->encode($this->path);
203 if (!is_null($this->query)) {
204 $this->query = $qf_encoder->encode($this->query);
207 if (!is_null($this->fragment)) {
208 $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.