Documentation

Iri
in package

IRI parser/serialiser/normaliser

Copyright (c) 2007-2010, Geoffrey Sneddon and Steve Minutillo. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the SimplePie Team nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Tags
author

Geoffrey Sneddon

author

Steve Minutillo

copyright

2007-2009 Geoffrey Sneddon and Steve Minutillo

license

https://opensource.org/licenses/bsd-license.php

link
http://hg.gsnedders.com/iri/

Table of Contents

Properties

$authority  : string
$fragment  : string
$host  : string
$iauthority  : string
$ifragment  : string
$ihost  : string
$ipath  : string
$iquery  : string
$iri  : string
$iuserinfo  : string
$path  : string
$port  : string
$query  : string
$scheme  : string
$uri  : string
$userinfo  : string
$ifragment  : string
ifragment|null
$ihost  : string|null
ihost
$ipath  : string
ipath
$iquery  : string|null
iquery
$iuserinfo  : string|null
User Information
$normalization  : array<string|int, mixed>
Normalization database
$port  : string|null
Port
$scheme  : string|null
Scheme

Methods

__construct()  : mixed
Create a new IRI object, from a specified string
__get()  : mixed
Overload __get() to provide access via properties
__isset()  : bool
Overload __isset() to provide access via properties
__set()  : mixed
Overload __set() to provide access via properties
__toString()  : string
Return the entire IRI when you try and read the object as a string
__unset()  : mixed
Overload __unset() to provide access via properties
absolutize()  : Iri|false
Create a new IRI object by resolving a relative IRI
is_valid()  : bool
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.
get_authority()  : string
Get the complete authority
get_iauthority()  : string|null
Get the complete iauthority
get_iri()  : string|false
Get the complete IRI
get_uri()  : string
Get the complete URI
parse_iri()  : array<string|int, mixed>
Parse an IRI into scheme/authority/path/query/fragment segments
remove_dot_segments()  : string
Remove dot segments from a path
remove_iunreserved_percent_encoded()  : string
Callback function for preg_replace_callback.
replace_invalid_with_pct_encoding()  : string
Replace invalid character with percent encoding
scheme_normalization()  : mixed
set_authority()  : bool
Set the authority. Returns true on success, false on failure (if there are any invalid characters).
set_fragment()  : bool
Set the ifragment.
set_host()  : bool
Set the ihost. Returns true on success, false on failure (if there are any invalid characters).
set_iri()  : bool
Set the entire IRI. Returns true on success, false on failure (if there are any invalid characters).
set_path()  : bool
Set the ipath.
set_port()  : bool
Set the port. Returns true on success, false on failure (if there are any invalid characters).
set_query()  : bool
Set the iquery.
set_scheme()  : bool
Set the scheme. Returns true on success, false on failure (if there are any invalid characters).
set_userinfo()  : bool
Set the iuserinfo.
to_uri()  : string|false
Convert an IRI to a URI (or parts thereof)

Properties

$authority

public string $authority

Authority part, formatted for a URI (userinfo + host + port)

$fragment

public string $fragment

Fragment, formatted for a URI (after '#')

$host

public string $host

Host part, formatted for a URI

$iauthority

public string $iauthority

Authority part of the IRI (userinfo + host + port)

$ifragment

public string $ifragment

Fragment part of the IRI (after '#')

$ihost

public string $ihost

Host part of the IRI

$ipath

public string $ipath

Path part of the IRI (after first '/')

$iquery

public string $iquery

Query part of the IRI (after '?')

$iri

public string $iri

IRI we're working with

$iuserinfo

public string $iuserinfo

Userinfo part of the IRI (after '://' and before '@')

$path

public string $path

Path part, formatted for a URI (after first '/')

$port

public string $port

Port part of the IRI (after ':')

$query

public string $query

Query part, formatted for a URI (after '?')

$scheme

public string $scheme

Scheme part of the IRI

$userinfo

public string $userinfo

Userinfo part, formatted for a URI (after '://' and before '@')

$ifragment

ifragment|null

protected string $ifragment = null

$ihost

ihost

protected string|null $ihost = null

$ipath

ipath

protected string $ipath = ''

$iquery

iquery

protected string|null $iquery = null

$iuserinfo

User Information

protected string|null $iuserinfo = null

$normalization

Normalization database

protected array<string|int, mixed> $normalization = array('acap' => array('port' => \WpOrg\Requests\Port::ACAP), 'dict' => array('port' => \WpOrg\Requests\Port::DICT), 'file' => array('ihost' => 'localhost'), 'http' => array('port' => \WpOrg\Requests\Port::HTTP), 'https' => array('port' => \WpOrg\Requests\Port::HTTPS))

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.

$port

Port

protected string|null $port = null

$scheme

Scheme

protected string|null $scheme = null

Methods

__construct()

Create a new IRI object, from a specified string

public __construct([string|Stringable|null $iri = null ]) : mixed
Parameters
$iri : string|Stringable|null = null
Tags
throws
InvalidArgument

When the passed $iri argument is not a string, Stringable or null.

__get()

Overload __get() to provide access via properties

public __get(string $name) : mixed
Parameters
$name : string

Property name

__isset()

Overload __isset() to provide access via properties

public __isset(string $name) : bool
Parameters
$name : string

Property name

Return values
bool

__set()

Overload __set() to provide access via properties

public __set(string $name, mixed $value) : mixed
Parameters
$name : string

Property name

$value : mixed

Property value

__toString()

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

public __toString() : string
Return values
string

__unset()

Overload __unset() to provide access via properties

public __unset(string $name) : mixed
Parameters
$name : string

Property name

absolutize()

Create a new IRI object by resolving a relative IRI

public static absolutize(Iri|string $base, Iri|string $relative) : Iri|false

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

Parameters
$base : Iri|string

(Absolute) Base IRI

$relative : Iri|string

Relative IRI

Return values
Iri|false

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.

public is_valid() : bool
Return values
bool

get_authority()

Get the complete authority

protected get_authority() : string
Return values
string

get_iauthority()

Get the complete iauthority

protected get_iauthority() : string|null
Return values
string|null

get_iri()

Get the complete IRI

protected get_iri() : string|false
Return values
string|false

get_uri()

Get the complete URI

protected get_uri() : string
Return values
string

parse_iri()

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

protected parse_iri(string $iri) : array<string|int, mixed>
Parameters
$iri : string
Return values
array<string|int, mixed>

remove_dot_segments()

Remove dot segments from a path

protected remove_dot_segments(string $input) : string
Parameters
$input : string
Return values
string

remove_iunreserved_percent_encoded()

Callback function for preg_replace_callback.

protected remove_iunreserved_percent_encoded(array<string|int, mixed> $regex_match) : string

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

Parameters
$regex_match : array<string|int, mixed>

PCRE match

Return values
string

Replacement

replace_invalid_with_pct_encoding()

Replace invalid character with percent encoding

protected replace_invalid_with_pct_encoding(string $text, string $extra_chars[, bool $iprivate = false ]) : string
Parameters
$text : string

Input string

$extra_chars : string

Valid characters not in iunreserved or iprivate (this is ASCII-only)

$iprivate : bool = false

Allow iprivate

Return values
string

scheme_normalization()

protected scheme_normalization() : mixed

set_authority()

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

protected set_authority(string $authority) : bool
Parameters
$authority : string
Return values
bool

set_fragment()

Set the ifragment.

protected set_fragment(string $ifragment) : bool
Parameters
$ifragment : string
Return values
bool

set_host()

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

protected set_host(string $ihost) : bool
Parameters
$ihost : string
Return values
bool

set_iri()

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

protected set_iri(string $iri) : bool
Parameters
$iri : string
Return values
bool

set_path()

Set the ipath.

protected set_path(string $ipath) : bool
Parameters
$ipath : string
Return values
bool

set_port()

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

protected set_port(string $port) : bool
Parameters
$port : string
Return values
bool

set_query()

Set the iquery.

protected set_query(string $iquery) : bool
Parameters
$iquery : string
Return values
bool

set_scheme()

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

protected set_scheme(string $scheme) : bool
Parameters
$scheme : string
Return values
bool

set_userinfo()

Set the iuserinfo.

protected set_userinfo(string $iuserinfo) : bool
Parameters
$iuserinfo : string
Return values
bool

to_uri()

Convert an IRI to a URI (or parts thereof)

protected to_uri(string|bool $iri) : string|false
Parameters
$iri : string|bool

IRI to convert (or false from Iri::get_iri())

Return values
string|false

URI if IRI is valid, false otherwise.


        
On this page

Search results