Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
HTTP(S) URI handler

array
$_regex= 'array'
Regular expression grammar rules for validation; values added by constructor
array
Details
__construct(
string $scheme, string $schemeSpecific
)
:
void
Constructor accepts a string $scheme (e.g., http, https) and a scheme-specific part of the URI (e.g., example.com/path/to/resource?query=param#fragment)
Use Zend_Uri::factory() to return a new Zend_Uri object.
Name | Type | Description |
---|---|---|
$scheme | string | The scheme of the URI |
$schemeSpecific | string | The scheme-specific part of the URI |
Exception | Description |
---|---|
\Zend_Uri_Exception | When the URI is not valid |

__toString(
)
:
string
Return a string representation of this URI.
Inherited from: \Zend_Uri::__toString()Type | Description |
---|---|
string |

_parseUri(
string $schemeSpecific
)
:
void
Parse the scheme-specific portion of the URI and place its parts into instance variables.
Name | Type | Description |
---|---|---|
$schemeSpecific | string | The scheme-specific portion to parse |
Exception | Description |
---|---|
\Zend_Uri_Exception | When scheme-specific decoposition fails |
\Zend_Uri_Exception | When authority decomposition fails |

addReplaceQueryParameters(
array $queryParams
)
:
string
Add or replace params in the query string for the current URI, and return the old query.
Name | Type | Description |
---|---|---|
$queryParams | array |
Type | Description |
---|---|
string | Old query string |

check(
string $uri
)
:
boolean
Convenience function, checks that a $uri string is well-formed by validating it but not returning an object. Returns TRUE if $uri is a well-formed URI, or FALSE otherwise.
Inherited from: \Zend_Uri::check()Name | Type | Description |
---|---|---|
$uri | string | The URI to check |
Type | Description |
---|---|
boolean |

factory(
string $uri
=
http, string $className
=
null
)
:
\Zend_Uri
Create a new Zend_Uri object for a URI. If building a new URI, then $uri should contain only the scheme (http, ftp, etc). Otherwise, supply $uri with the complete URI.
Inherited from: \Zend_Uri::factory()Name | Type | Description |
---|---|---|
$uri | string | The URI form which a Zend_Uri instance is created |
$className | string | The name of the class to use in order to manipulate URI |
Type | Description |
---|---|
\Zend_Uri |
Exception | Description |
---|---|
\Zend_Uri_Exception | When an empty string was supplied for the scheme |
\Zend_Uri_Exception | When an illegal scheme is supplied |
\Zend_Uri_Exception | When the scheme is not supported |
\Zend_Uri_Exception | When $className doesn't exist or doesn't implements Zend_Uri |

fromString(
string $uri
)
:
\Zend_Uri_Http
Creates a Zend_Uri_Http from the given string
Name | Type | Description |
---|---|---|
$uri | string | String to create URI from, must start with 'http://' or 'https://' |
Type | Description |
---|---|
\Zend_Uri_Http |
Exception | Description |
---|---|
\InvalidArgumentException | When the given $uri is not a string or does not start with http:// or https:// |
\Zend_Uri_Exception | When the given $uri is invalid |

getFragment(
)
:
string|false
Returns the fragment portion of the URL (after #), or FALSE if none.
Type | Description |
---|---|
stringfalse |

getHost(
)
:
string
Returns the domain or host IP portion of the URL, or FALSE if none.
Type | Description |
---|---|
string |

getPassword(
)
:
string
Returns the password portion of the URL, or FALSE if none.
Type | Description |
---|---|
string |

getPath(
)
:
string
Returns the path and filename portion of the URL.
Type | Description |
---|---|
string |

getQuery(
)
:
string
Returns the query portion of the URL (after ?), or FALSE if none.
Type | Description |
---|---|
string |

getQueryAsArray(
)
:
array
Returns the query portion of the URL (after ?) as a key-value-array. If the query is empty an empty array is returned
Type | Description |
---|---|
array |

getScheme(
)
:
string|false
Get the URI's scheme
Inherited from: \Zend_Uri::getScheme()Type | Description |
---|---|
stringfalse | Scheme or false if no scheme is set. |

getUri(
)
:
string
Returns a URI based on current values of the instance variables. If any part of the URI does not pass validation, then an exception is thrown.
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Uri_Exception | When one or more parts of the URI are invalid |

getUsername(
)
:
string
Returns the username portion of the URL, or FALSE if none.
Type | Description |
---|---|
string |

removeQueryParameters(
array $queryParamKeys
)
:
string
Remove params in the query string for the current URI, and return the old query.
Name | Type | Description |
---|---|---|
$queryParamKeys | array |
Type | Description |
---|---|
string | Old query string |

setConfig(
\Zend_Config|array $config
)
:
void
Name | Type | Description |
---|---|---|
$config | \Zend_Config|array |

setFragment(
string $fragment
)
:
string
Sets the fragment for the current URI, and returns the old fragment
Name | Type | Description |
---|---|---|
$fragment | string | Fragment of the current URI |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Uri_Exception | When $fragment is not a valid HTTP fragment |

setHost(
string $host
)
:
string
Sets the host for the current URI, and returns the old host
Name | Type | Description |
---|---|---|
$host | string | The HTTP host |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Uri_Exception | When $host is nota valid HTTP host |

setPassword(
string $password
)
:
string
Sets the password for the current URI, and returns the old password
Name | Type | Description |
---|---|---|
$password | string | The HTTP password |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Uri_Exception | When $password is not a valid HTTP password |

setPath(
string $path
)
:
string
Sets the path for the current URI, and returns the old path
Name | Type | Description |
---|---|---|
$path | string | The HTTP path |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Uri_Exception | When $path is not a valid HTTP path |

setPort(
string $port
)
:
string
Sets the port for the current URI, and returns the old port
Name | Type | Description |
---|---|---|
$port | string | The HTTP port |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Uri_Exception | When $port is not a valid HTTP port |

setQuery(
string|array $query
)
:
string
Set the query string for the current URI, and return the old query string This method accepts both strings and arrays.
Name | Type | Description |
---|---|---|
$query | string|array | The query string or array |
Type | Description |
---|---|
string | Old query string |
Exception | Description |
---|---|
\Zend_Uri_Exception | When $query is not a valid query string |

setUsername(
string $username
)
:
string
Sets the username for the current URI, and returns the old username
Name | Type | Description |
---|---|---|
$username | string | The HTTP username |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Uri_Exception | When $username is not a valid HTTP username |

valid(
)
:
boolean
Validate the current URI from the instance variables. Returns true if and only if all parts pass validation.
Type | Description |
---|---|
boolean |

validateFragment(
string $fragment
=
null
)
:
boolean
Returns true if and only if the fragment passes validation. If no fragment is passed, then the fragment contained in the instance variable is used.
Name | Type | Description |
---|---|---|
$fragment | string | Fragment of an URI |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Uri_Exception | When fragment validation fails |

validateHost(
string $host
=
null
)
:
boolean
Returns true if and only if the host string passes validation. If no host is passed, then the host contained in the instance variable is used.
Name | Type | Description |
---|---|---|
$host | string | The HTTP host |
Type | Description |
---|---|
boolean |

validatePassword(
string $password
=
null
)
:
boolean
Returns true if and only if the password passes validation. If no password is passed, then the password contained in the instance variable is used.
Name | Type | Description |
---|---|---|
$password | string | The HTTP password |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Uri_Exception | When password validation fails |

validatePath(
string $path
=
null
)
:
boolean
Returns true if and only if the path string passes validation. If no path is passed, then the path contained in the instance variable is used.
Name | Type | Description |
---|---|---|
$path | string | The HTTP path |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Uri_Exception | When path validation fails |

validatePort(
string $port
=
null
)
:
boolean
Returns true if and only if the TCP port string passes validation. If no port is passed, then the port contained in the instance variable is used.
Name | Type | Description |
---|---|---|
$port | string | The HTTP port |
Type | Description |
---|---|
boolean |

validateQuery(
string $query
=
null
)
:
boolean
Returns true if and only if the query string passes validation. If no query is passed, then the query string contained in the instance variable is used.
Name | Type | Description |
---|---|---|
$query | string | The query to validate |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Uri_Exception | When query validation fails |

validateUsername(
string $username
=
null
)
:
boolean
Returns true if and only if the username passes validation. If no username is passed, then the username contained in the instance variable is used.
Name | Type | Description |
---|---|---|
$username | string | The HTTP username |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Uri_Exception | When username validation fails |