78        if ($this->scheme !== 
null) {
 
   79            $scheme_obj = $registry->getScheme($this->scheme, 
$config, $context);
 
   85            $def = 
$config->getDefinition(
'URI');
 
   86            $scheme_obj = $def->getDefaultScheme(
$config, $context);
 
   90                    'Default scheme object "' . $def->defaultScheme . 
'" was not readable',
 
  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);
 
  224        if (!is_null($this->host)) {
 
  226            if (!is_null($this->userinfo)) {
 
  227                $authority .= $this->userinfo . 
'@';
 
  230            if (!is_null($this->port)) {
 
  242        if (!is_null($this->scheme)) {
 
  243            $result .= $this->scheme . 
':';
 
  245        if (!is_null($authority)) {
 
  249        if (!is_null($this->query)) {
 
  252        if (!is_null($this->fragment)) {
 
  273        if ($this->host === 
null) {
 
  276        $uri_def = 
$config->getDefinition(
'URI');
 
  277        if ($uri_def->host === $this->host) {
 
  304        $current_scheme_obj = 
$config->getDefinition(
'URI')->getDefaultScheme(
$config, $context);
 
  305        if ($current_scheme_obj->secure) {
 
  306            if (!$scheme_obj->secure) {
 
An exception for terminatinating execution or to throw for unit testing.
Validates a host according to the IPv4, IPv6 and DNS (future) specifications.
Class that handles operations involving percent-encoding in URIs.
static instance($prototype=null)
Retrieve sole instance of the registry.
HTML Purifier's internal representation of a URI.
isLocal($config, $context)
Returns true if this URL might be considered a 'local' URL given the current context.
validate($config, $context)
Generic validation method applicable for all schemes.
toString()
Convert URI back to string.
getSchemeObj($config, $context)
Retrieves a scheme object corresponding to the URI's scheme/default.
__construct($scheme, $userinfo, $host, $port, $path, $query, $fragment)
isBenign($config, $context)
Returns true if this URL should be considered a 'benign' URL, that is: