UriImmutable
Extends AbstractUriUriImmutable Class
This is an immutable version of the AbstractUri class.
since |
1.0 |
---|---|
package |
Joomla Framework |
Methods
__construct
Constructor.
__construct(string uri = null) : mixed
You can pass a URI string to the constructor to initialise a specific URI.
since |
1.0 |
---|
Arguments
- uri
string
The optional URI string
Response
mixed
__set
Prevent setting undeclared properties.
__set(string name, mixed value) : void
since |
1.0 |
---|---|
throws |
|
Arguments
- name
string
This is an immutable object, setting $name is not allowed.- value
mixed
This is an immutable object, setting $value is not allowed.
__toString
Magic method to get the string representation of the UriInterface object.
__toString() : string
since |
1.0 |
---|
Response
string
buildQuery
Build a query from an array (reverse of the PHP parse_str()).
buildQuery(array params) : string
see | parse_str() |
---|---|
since |
1.0 |
Arguments
- params
array
The array of key => value pairs to return as a query string.
Response
string
The resulting query string.
cleanPath
Resolves //, ../ and ./ from a path and returns the result.
cleanPath(string path) : string
For example: /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
string
The URI path to clean.
Response
string
Cleaned and resolved URI path.
getFragment
Get the URI anchor string
getFragment() : string
since |
1.0 |
---|
Response
string
The URI anchor string.
getHost
Get the URI host
getHost() : string
since |
1.0 |
---|
Response
string
The hostname/IP or null if no hostname/IP was specified.
getPass
Get the URI password
getPass() : string
since |
1.0 |
---|
Response
string
The password, or null if no password was specified.
getPath
Gets the URI path string
getPath() : string
since |
1.0 |
---|
Response
string
The URI path string.
getPort
Get the URI port
getPort() : int
since |
1.0 |
---|
Response
int
The port number, or null if no port was specified.
getQuery
Returns flat query string.
getQuery(bool toArray = false) : string|array
since |
1.0 |
---|
Arguments
- toArray
bool
True to return the query as a key => value pair array.
Response
string|array
Query string or Array of parts in query string depending on the function param
getScheme
Get the URI scheme (protocol)
getScheme() : string
since |
1.0 |
---|
Response
string
The URI scheme.
getUser
Get the URI username
getUser() : string
since |
1.0 |
---|
Response
string
The username, or null if no username was specified.
getVar
Returns a query variable by name.
getVar(string name, string default = null) : mixed
since |
1.0 |
---|
Arguments
- name
string
Name of the query variable to get.- default
string
Default value to return if the variable is not set.
Response
mixed
Requested query variable if present otherwise the default value.
hasVar
Checks if variable exists.
hasVar(string name) : bool
since |
1.0 |
---|
Arguments
- name
string
Name of the query variable to check.
Response
bool
True if the variable exists.
isSsl
Checks whether the current URI is using HTTPS.
isSsl() : bool
since |
1.0 |
---|
Response
bool
True if using SSL via HTTPS.
parse
Parse a given URI and populate the class fields.
parse(string uri) : bool
since |
1.0 |
---|
Arguments
- uri
string
The URI string to parse.
Response
bool
True on success.
render
Returns full uri string.
render(int parts = self::ALL) : string
since |
1.2.0 |
---|
Arguments
- parts
int
A bitmask specifying the parts to render.
Response
string
The rendered URI string.
toString
Returns full URI string.
toString(array parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment']) : string
since |
1.0 |
---|
Arguments
- parts
array
An array of strings specifying the parts to render.
Response
string
The rendered URI string.
Properties
constructed
Flag if the class been instantiated
since |
1.0 |
---|
Type(s)
bool
uri
Original URI
since |
1.0 |
---|
Type(s)
string
scheme
Protocol
since |
1.0 |
---|
Type(s)
string
host
Host
since |
1.0 |
---|
Type(s)
string
port
Port
since |
1.0 |
---|
Type(s)
int
user
Username
since |
1.0 |
---|
Type(s)
string
pass
Password
since |
1.0 |
---|
Type(s)
string
path
Path
since |
1.0 |
---|
Type(s)
string
query
Query
since |
1.0 |
---|
Type(s)
string
fragment
Anchor
since |
1.0 |
---|
Type(s)
string
vars
Query variable hash
since |
1.0 |
---|
Type(s)
array