EasyRdf API Documentation
Class

EasyRdf_ParsedUri

class EasyRdf_ParsedUri

A RFC3986 compliant URI parser

Constants

URI_REGEX

Methods

object __construct(mixed $uri = null)

Constructor for creating a new parsed URI

boolean isAbsolute()

Returns true if this is an absolute (complete) URI

boolean isRelative()

Returns true if this is an relative (partial) URI

string getScheme()

Returns the scheme of the URI (e.g.

setScheme(string $scheme)

Sets the scheme of the URI (e.g.

string getAuthority()

Returns the authority of the URI (e.g.

setAuthority(string $authority)

Sets the authority of the URI (e.g.

string getPath()

Returns the path of the URI (e.g.

setPath(string $path)

Set the path of the URI (e.g.

string getQuery()

Returns the query string part of the URI (e.g.

setQuery(string $query)

Set the query string of the URI (e.g.

string getFragment()

Returns the fragment part of the URI (i.e.

setFragment(string $fragment)

Set the fragment of the URI (i.e.

object normalise()

Normalises the path of this URI if it has one.

resolve($relUri)

Resolves a relative URI using this URI as the base URI.

string toString()

Convert the parsed URI back into a string

string __toString()

Magic method to convert the URI, when casted, back to a string

Details

at line 69
public object __construct(mixed $uri = null)

Constructor for creating a new parsed URI

The $uri parameter can either be a string or an associative array with the following keys: scheme, authority, path, query, fragment

Parameters

mixed $uri The URI as a string or an array

Return Value

object EasyRdf_ParsedUri

at line 100
public boolean isAbsolute()

Returns true if this is an absolute (complete) URI

Return Value

boolean

at line 108
public boolean isRelative()

Returns true if this is an relative (partial) URI

Return Value

boolean

at line 116
public string getScheme()

Returns the scheme of the URI (e.g.

http)

Return Value

string

at line 124
public setScheme(string $scheme)

Sets the scheme of the URI (e.g.

http)

Parameters

string $scheme The new value for the scheme of the URI

at line 132
public string getAuthority()

Returns the authority of the URI (e.g.

www.example.com:8080)

Return Value

string

at line 140
public setAuthority(string $authority)

Sets the authority of the URI (e.g.

www.example.com:8080)

Parameters

string $authority The new value for the authority component of the URI

at line 148
public string getPath()

Returns the path of the URI (e.g.

/foo/bar)

Return Value

string

at line 156
public setPath(string $path)

Set the path of the URI (e.g.

/foo/bar)

Parameters

string $path The new value for the path component of the URI

at line 164
public string getQuery()

Returns the query string part of the URI (e.g.

foo=bar)

Return Value

string

at line 172
public setQuery(string $query)

Set the query string of the URI (e.g.

foo=bar)

Parameters

string $query The new value for the query string component of the URI

at line 180
public string getFragment()

Returns the fragment part of the URI (i.e.

after the #)

Return Value

string

at line 188
public setFragment(string $fragment)

Set the fragment of the URI (i.e.

after the #)

Parameters

string $fragment The new value for the fragment component of the URI

at line 202
public object normalise()

Normalises the path of this URI if it has one.

Normalising a path means that any unnecessary '.' and '..' segments are removed. For example, the URI http://example.com/a/b/../c/./d would be normalised to http://example.com/a/c/d

Return Value

object EasyRdf_ParsedUri

at line 254
public resolve($relUri)

Resolves a relative URI using this URI as the base URI.

Parameters

$relUri

at line 313
public string toString()

Convert the parsed URI back into a string

Return Value

string The URI as a string

at line 336
public string __toString()

Magic method to convert the URI, when casted, back to a string

Return Value

string The URI as a string