UriImmutable

Extends AbstractUri

Uri Class

final

This is an immutable version of the uri class.

since

1.0

package

Joomla Framework

Methods

__construct

Constructor.

__construct(string uri = null) : mixed
inherited

You can pass a URI string to the constructor to initialise a specific URI.

since

1.0

Arguments

uri

stringThe optional URI string

Response

mixed

__set

Prevent setting undeclared properties.

__set(string name, mixed value) : void
since

1.0

throws

\BadMethodCallException

Arguments

name

stringThis is an immutable object, setting $name is not allowed.

value

mixedThis is an immutable object, setting $value is not allowed.

__toString

Magic method to get the string representation of the URI object.

__toString() : string
inherited
since

1.0

Response

string

buildQuery

Build a query from an array (reverse of the PHP parse_str()).

buildQuery(array params) : string
inherited static
see parse_str()
since

1.0

Arguments

params

arrayThe array of key => value pairs to return as a query string.

Response

stringThe resulting query string.

cleanPath

Resolves //, ../ and ./ from a path and returns the result. Eg:

cleanPath(string path) : string
inherited

/foo/bar/../boo.php => /foo/boo.php /foo/bar/../../boo.php => /boo.php /foo/bar/.././/boo.php => /foo/boo.php

since

1.0

Arguments

path

stringThe URI path to clean.

Response

stringCleaned and resolved URI path.

getFragment

Get the URI anchor string Everything after the "#".

getFragment() : string
inherited
since

1.0

Response

stringThe URI anchor string.

getHost

Get URI host Returns the hostname/ip or null if no hostname/ip was specified.

getHost() : string
inherited
since

1.0

Response

stringThe URI host.

getPass

Get URI password Returns the password, or null if no password was specified.

getPass() : string
inherited
since

1.0

Response

stringThe URI password.

getPath

Gets the URI path string.

getPath() : string
inherited
since

1.0

Response

stringThe URI path string.

getPort

Get URI port Returns the port number, or null if no port was specified.

getPort() : int
inherited
since

1.0

Response

intThe URI port number.

getQuery

Returns flat query string.

getQuery(bool toArray = false) : string|array
inherited
since

1.0

Arguments

toArray

boolTrue to return the query as a key => value pair array.

Response

string|arrayQuery string or Array of parts in query string depending on the function param

getScheme

Get URI scheme (protocol) ie. http, https, ftp, etc.

getScheme() : string
inherited

..

since

1.0

Response

stringThe URI scheme.

getUser

Get URI username Returns the username, or null if no username was specified.

getUser() : string
inherited
since

1.0

Response

stringThe URI username.

getVar

Returns a query variable by name.

getVar(string name, string default = null) : mixed
inherited
since

1.0

Arguments

name

stringName of the query variable to get.

default

stringDefault value to return if the variable is not set.

Response

mixedValue of the specified query variable.

hasVar

Checks if variable exists.

hasVar(string name) : bool
inherited
since

1.0

Arguments

name

stringName of the query variable to check.

Response

boolTrue if the variable exists.

isSsl

Checks whether the current URI is using HTTPS.

isSsl() : bool
inherited
since

1.0

Response

boolTrue if using SSL via HTTPS.

parse

Parse a given URI and populate the class fields.

parse(string uri) : bool
inherited
since

1.0

Arguments

uri

stringThe URI string to parse.

Response

boolTrue on success.

render

Returns full uri string.

render(int parts = self::ALL) : string
inherited
since

1.2.0

Arguments

parts

intA bitmask specifying the parts to render.

Response

stringThe rendered URI string.

toString

Returns full uri string.

toString(array parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment')) : string
inherited
since

1.0

Arguments

parts

arrayAn array of strings specifying the parts to render.

Response

stringThe rendered URI string.

Properties

constructed

Has this class been instantiated yet.

since

1.0

Type(s)

bool

uri

Original URI

inherited
since

1.0

Type(s)

string

scheme

Protocol

inherited
since

1.0

Type(s)

string

host

Host

inherited
since

1.0

Type(s)

string

port

Port

inherited
since

1.0

Type(s)

int

user

Username

inherited
since

1.0

Type(s)

string

pass

Password

inherited
since

1.0

Type(s)

string

path

Path

inherited
since

1.0

Type(s)

string

query

Query

inherited
since

1.0

Type(s)

string

fragment

Anchor

inherited
since

1.0

Type(s)

string

vars

Query variable hash

inherited
since

1.0

Type(s)

array