37 if ($this->scheme !== null) {
38 $scheme_obj = $registry->getScheme($this->scheme, $config, $context);
39 if (!$scheme_obj)
return false;
42 $def = $config->getDefinition(
'URI');
43 $scheme_obj = $def->getDefaultScheme($config, $context);
47 'Default scheme object "' . $def->defaultScheme .
'" was not readable',
66 $chars_sub_delims =
'!$&\'()*+,;=';
67 $chars_gen_delims =
':/?#[]@';
68 $chars_pchar = $chars_sub_delims .
':@';
71 if (!is_null($this->host)) {
73 $this->host = $host_def->validate($this->host, $config, $context);
74 if ($this->host ===
false) $this->host = null;
83 if (!is_null($this->scheme) && is_null($this->host) || $this->host ===
'') {
86 $def = $config->getDefinition(
'URI');
87 if ($def->defaultScheme === $this->scheme) {
93 if (!is_null($this->userinfo)) {
95 $this->userinfo = $encoder->encode($this->userinfo);
99 if (!is_null($this->port)) {
100 if ($this->port < 1 || $this->port > 65535) $this->port = null;
104 $path_parts = array();
106 if (!is_null($this->host)) {
115 $this->path = $segments_encoder->encode($this->path);
116 } elseif ($this->path !==
'') {
117 if ($this->path[0] ===
'/') {
121 if (strlen($this->path) >= 2 && $this->path[1] ===
'/') {
128 $this->path = $segments_encoder->encode($this->path);
130 } elseif (!is_null($this->scheme)) {
134 $this->path = $segments_encoder->encode($this->path);
140 $c = strpos($this->path,
'/');
143 $segment_nc_encoder->encode(substr($this->path, 0, $c)) .
144 $segments_encoder->encode(substr($this->path, $c));
146 $this->path = $segment_nc_encoder->encode($this->path);
157 if (!is_null($this->query)) {
158 $this->query = $qf_encoder->encode($this->query);
161 if (!is_null($this->fragment)) {
162 $this->fragment = $qf_encoder->encode($this->fragment);
179 if (!is_null($this->host)) {
181 if(!is_null($this->userinfo)) $authority .= $this->userinfo .
'@';
183 if(!is_null($this->port)) $authority .=
':' .
$this->port;
193 if (!is_null($this->scheme))
$result .= $this->scheme .
':';
194 if (!is_null($authority))
$result .=
'//' . $authority;
212 if ($this->host === null)
return true;
213 $uri_def = $config->getDefinition(
'URI');
214 if ($uri_def->host === $this->host)
return true;
226 if (!$this->
isLocal($config, $context))
return false;
229 if (!$scheme_obj)
return false;
231 $current_scheme_obj = $config->getDefinition(
'URI')->getDefaultScheme($config, $context);
232 if ($current_scheme_obj->secure) {
233 if (!$scheme_obj->secure) {