Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
IRI Class Reference

IRI parser/serialiser/normaliser. More...

Public Member Functions

 __construct ($iri=null)
 Create a new IRI object, from a specified string.
 
 __destruct ()
 Clean up.
 
 __get ($name)
 Overload __get() to provide access via properties.
 
 __isset ($name)
 Overload __isset() to provide access via properties.
 
 __set ($name, $value)
 Overload __set() to provide access via properties.
 
 __toString ()
 Return the entire IRI when you try and read the object as a string.
 
 __unset ($name)
 Overload __unset() to provide access via properties.
 
 get_iri ()
 Get the complete IRI.
 
 get_uri ()
 Get the complete URI.
 
 is_valid ()
 Check if the object represents a valid IRI.
 
 set_authority ($authority, $clear_cache=false)
 Set the authority.
 
 set_fragment ($ifragment)
 Set the ifragment.
 
 set_host ($ihost)
 Set the ihost.
 
 set_iri ($iri, $clear_cache=false)
 Set the entire IRI.
 
 set_path ($ipath, $clear_cache=false)
 Set the ipath.
 
 set_port ($port)
 Set the port.
 
 set_query ($iquery)
 Set the iquery.
 
 set_scheme ($scheme)
 Set the scheme.
 
 set_userinfo ($iuserinfo)
 Set the iuserinfo.
 
 to_uri ($string)
 Convert an IRI to a URI (or parts thereof)
 

Static Public Member Functions

static absolutize ($base, $relative)
 Create a new IRI object by resolving a relative IRI.
 

Protected Member Functions

 get_authority ()
 Get the complete authority.
 
 get_iauthority ()
 Get the complete iauthority.
 
 parse_iri ($iri)
 Parse an IRI into scheme/authority/path/query/fragment segments.
 
 remove_dot_segments ($input)
 Remove dot segments from a path.
 
 remove_iunreserved_percent_encoded ($match)
 Callback function for preg_replace_callback.
 
 replace_invalid_with_pct_encoding ($string, $extra_chars, $iprivate=false)
 Replace invalid character with percent encoding.
 
 scheme_normalization ()
 

Protected Attributes

string $ifragment = null
 ifragment
 
string $ihost = null
 ihost
 
string $ipath = ''
 ipath
 
string $iquery = null
 iquery
 
string $iuserinfo = null
 User Information.
 
 $normalization
 Normalization database.
 
string $port = null
 Port.
 
string $scheme = null
 Scheme.
 

Detailed Description

IRI parser/serialiser/normaliser.

@subpackage HTTP

Author
Sam Sneddon
Steve Minutillo
Ryan McCue
License
http://www.opensource.org/licenses/bsd-license.php

Constructor & Destructor Documentation

◆ __construct()

IRI::__construct ( $iri = null)

Create a new IRI object, from a specified string.

Parameters
string$iri

Member Function Documentation

◆ __get()

IRI::__get ( $name)

Overload __get() to provide access via properties.

Parameters
string$nameProperty name
Return values
mixed

◆ __isset()

IRI::__isset ( $name)

Overload __isset() to provide access via properties.

Parameters
string$nameProperty name
Return values
bool

◆ __set()

IRI::__set ( $name,
$value )

Overload __set() to provide access via properties.

Parameters
string$nameProperty name
mixed$valueProperty value

◆ __toString()

IRI::__toString ( )

Return the entire IRI when you try and read the object as a string.

Return values
string

◆ __unset()

IRI::__unset ( $name)

Overload __unset() to provide access via properties.

Parameters
string$nameProperty name

◆ absolutize()

static IRI::absolutize ( $base,
$relative )
static

Create a new IRI object by resolving a relative IRI.

Returns false if $base is not absolute, otherwise an IRI.

Parameters
IRI | string$base(Absolute) Base IRI
IRI | string$relativeRelative IRI
Return values
IRI|false

◆ get_authority()

IRI::get_authority ( )
protected

Get the complete authority.

Return values
string

◆ get_iauthority()

IRI::get_iauthority ( )
protected

Get the complete iauthority.

Return values
string

◆ get_iri()

IRI::get_iri ( )

Get the complete IRI.

Return values
string

◆ get_uri()

IRI::get_uri ( )

Get the complete URI.

Return values
string

◆ is_valid()

IRI::is_valid ( )

Check if the object represents a valid IRI.

This needs to be done on each call as some things change depending on another part of the IRI.

Return values
bool

◆ parse_iri()

IRI::parse_iri ( $iri)
protected

Parse an IRI into scheme/authority/path/query/fragment segments.

Parameters
string$iri
Return values
array

◆ remove_dot_segments()

IRI::remove_dot_segments ( $input)
protected

Remove dot segments from a path.

Parameters
string$input
Return values
string

◆ remove_iunreserved_percent_encoded()

IRI::remove_iunreserved_percent_encoded ( $match)
protected

Callback function for preg_replace_callback.

Removes sequences of percent encoded bytes that represent UTF-8 encoded characters in iunreserved

Parameters
array$matchPCRE match
Return values
stringReplacement

◆ replace_invalid_with_pct_encoding()

IRI::replace_invalid_with_pct_encoding ( $string,
$extra_chars,
$iprivate = false )
protected

Replace invalid character with percent encoding.

Parameters
string$stringInput string
string$extra_charsValid characters not in iunreserved or iprivate (this is ASCII-only)
bool$iprivateAllow iprivate
Return values
string

◆ set_authority()

IRI::set_authority ( $authority,
$clear_cache = false )

Set the authority.

Returns true on success, false on failure (if there are any invalid characters).

Parameters
string$authority
Return values
bool

◆ set_fragment()

IRI::set_fragment ( $ifragment)

Set the ifragment.

Parameters
string$ifragment
Return values
bool

◆ set_host()

IRI::set_host ( $ihost)

Set the ihost.

Returns true on success, false on failure (if there are any invalid characters).

Parameters
string$ihost
Return values
bool

◆ set_iri()

IRI::set_iri ( $iri,
$clear_cache = false )

Set the entire IRI.

Returns true on success, false on failure (if there are any invalid characters).

Parameters
string$iri
Return values
bool

◆ set_path()

IRI::set_path ( $ipath,
$clear_cache = false )

Set the ipath.

Parameters
string$ipath
Return values
bool

◆ set_port()

IRI::set_port ( $port)

Set the port.

Returns true on success, false on failure (if there are any invalid characters).

Parameters
string$port
Return values
bool

◆ set_query()

IRI::set_query ( $iquery)

Set the iquery.

Parameters
string$iquery
Return values
bool

◆ set_scheme()

IRI::set_scheme ( $scheme)

Set the scheme.

Returns true on success, false on failure (if there are any invalid characters).

Parameters
string$scheme
Return values
bool

◆ set_userinfo()

IRI::set_userinfo ( $iuserinfo)

Set the iuserinfo.

Parameters
string$iuserinfo
Return values
bool

◆ to_uri()

IRI::to_uri ( $string)

Convert an IRI to a URI (or parts thereof)

Return values
string

Member Data Documentation

◆ $normalization

IRI::$normalization
protected
Initial value:
= [
'acap' => [
'port' => 674
],
'dict' => [
'port' => 2628
],
'file' => [
'ihost' => 'localhost'
],
'http' => [
'port' => 80,
'ipath' => '/'
],
'https' => [
'port' => 443,
'ipath' => '/'
],
]

Normalization database.

Each key is the scheme, each value is an array with each key as the IRI part and value as the default value for that part.


The documentation for this class was generated from the following file: