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 = $registry->getScheme($def->defaultScheme,
$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->scheme) && is_null($this->host)) {
72 $def =
$config->getDefinition(
'URI');
73 if ($def->defaultScheme === $this->scheme) {
79 if (!is_null($this->host)) {
81 $this->host = $host_def->validate($this->host,
$config, $context);
82 if ($this->host ===
false) $this->host = null;
86 if (!is_null($this->userinfo)) {
88 $this->userinfo = $encoder->encode($this->userinfo);
92 if (!is_null($this->port)) {
93 if ($this->port < 1 || $this->port > 65535) $this->port = null;
97 $path_parts = array();
99 if (!is_null($this->host)) {
101 $this->path = $segments_encoder->encode($this->path);
102 } elseif ($this->path !==
'' && $this->path[0] ===
'/') {
104 if (strlen($this->path) >= 2 && $this->path[1] ===
'/') {
108 $this->path = $segments_encoder->encode($this->path);
110 } elseif (!is_null($this->scheme) && $this->path !==
'') {
113 $this->path = $segments_encoder->encode($this->path);
114 } elseif (is_null($this->scheme) && $this->path !==
'') {
118 $c = strpos($this->path,
'/');
121 $segment_nc_encoder->encode(substr($this->path, 0, $c)) .
122 $segments_encoder->encode(substr($this->path, $c));
124 $this->path = $segment_nc_encoder->encode($this->path);
134 if (!is_null($this->query)) {
135 $this->query = $qf_encoder->encode($this->query);
138 if (!is_null($this->fragment)) {
139 $this->fragment = $qf_encoder->encode($this->fragment);
153 if (!is_null($this->host)) {
155 if(!is_null($this->userinfo)) $authority .= $this->userinfo .
'@';
157 if(!is_null($this->port)) $authority .=
':' .
$this->port;
162 if (!is_null($this->scheme)) $result .= $this->scheme .
':';
163 if (!is_null($authority)) $result .=
'//' . $authority;
165 if (!is_null($this->query)) $result .=
'?' .
$this->query;