78        if ($this->scheme !== 
null) {
 
   79            $scheme_obj = $registry->getScheme($this->scheme, 
$config, $context);
 
   86            $scheme_obj = 
$def->getDefaultScheme(
$config, $context);
 
   88                if (
$def->defaultScheme !== 
null) {
 
   91                        'Default scheme object "' . 
$def->defaultScheme . 
'" was not readable',
 
  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);
 
  226        if (!is_null($this->host)) {
 
  228            if (!is_null($this->userinfo)) {
 
  232            if (!is_null($this->port)) {
 
  244        if (!is_null($this->scheme)) {
 
  245            $result .= $this->scheme . 
':';
 
  251        if (!is_null($this->query)) {
 
  254        if (!is_null($this->fragment)) {
 
  275        if ($this->host === 
null) {
 
  278        $uri_def = 
$config->getDefinition(
'URI');
 
  279        if ($uri_def->host === $this->host) {
 
  306        $current_scheme_obj = 
$config->getDefinition(
'URI')->getDefaultScheme(
$config, $context);
 
  307        if ($current_scheme_obj->secure) {
 
  308            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: