category |
Zend |
package |
Zend_Uri |
uses |
|
copyright |
Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license |
New BSD License |
inherited_from |
\Zend_Uri |
Methods
Return a string representation of this URI.
__toString() : string
Inherited
Add or replace params in the query string for the current URI, and
return the old query.
addReplaceQueryParameters(array $queryParams) : string
Parameters
$queryParams
array
Returns
string
Old query string
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.
check(string $uri) : boolean
InheritedStatic
Parameters
$uri
string
The URI to check
Returns
boolean
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.
factory(string $uri = 'http'
, string $className = null
) : \Zend_Uri
InheritedStatic
Parameters
$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
Exceptions
\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 |
Returns
\Zend_Uri
Creates a Zend_Uri_Http from the given string
fromString(string $uri) : \Zend_Uri_Http
Static
Parameters
$uri
string
String to create URI from, must start with
'http://' or 'https://'
Exceptions
\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 |
Returns
\Zend_Uri_Http
Returns the fragment portion of the URL (after #), or FALSE if none.
getFragment() : string | false
Returns the domain or host IP portion of the URL, or FALSE if none.
getHost() : string
Returns the password portion of the URL, or FALSE if none.
getPassword() : string
Returns the path and filename portion of the URL.
getPath() : string
Returns the TCP port, or FALSE if none.
getPort() : string
Returns the query portion of the URL (after ?), or FALSE if none.
getQuery() : string
Returns the query portion of the URL (after ?) as a
key-value-array. If the query is empty an empty array
is returned
getQueryAsArray() : array
Get the URI's scheme
getScheme() : string | false
Inherited
Returns
string
false
Scheme or false if no scheme is set.
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.
getUri() : string
inherited_from |
\Zend_Uri::getUri() |
Exceptions
\Zend_Uri_Exception |
When one or more parts of the URI are invalid |
Returns
string
Return a string representation of this URI.
getUri() : string
Inherited
Returns the username portion of the URL, or FALSE if none.
getUsername() : string
Remove params in the query string for the current URI, and
return the old query.
removeQueryParameters(array $queryParamKeys) : string
Parameters
$queryParamKeys
array
Returns
string
Old query string
Set global configuration options
setConfig(\Zend_Config|array $config)
InheritedStatic
Parameters
$config
\Zend_Config
array
Sets the fragment for the current URI, and returns the old fragment
setFragment(string $fragment) : string
Parameters
$fragment
string
Fragment of the current URI
Exceptions
\Zend_Uri_Exception |
When $fragment is not a valid HTTP fragment |
Returns
string
Sets the host for the current URI, and returns the old host
setHost(string $host) : string
Parameters
$host
string
The HTTP host
Exceptions
\Zend_Uri_Exception |
When $host is nota valid HTTP host |
Returns
string
Sets the password for the current URI, and returns the old password
setPassword(string $password) : string
Parameters
$password
string
The HTTP password
Exceptions
\Zend_Uri_Exception |
When $password is not a valid HTTP password |
Returns
string
Sets the path for the current URI, and returns the old path
setPath(string $path) : string
Parameters
$path
string
The HTTP path
Exceptions
\Zend_Uri_Exception |
When $path is not a valid HTTP path |
Returns
string
Sets the port for the current URI, and returns the old port
setPort(string $port) : string
Parameters
$port
string
The HTTP port
Exceptions
\Zend_Uri_Exception |
When $port is not a valid HTTP port |
Returns
string
Set the query string for the current URI, and return the old query
string This method accepts both strings and arrays.
setQuery(string|array $query) : string
Parameters
$query
string
array
The query string or array
Exceptions
\Zend_Uri_Exception |
When $query is not a valid query string |
Returns
string
Old query string
Sets the username for the current URI, and returns the old username
setUsername(string $username) : string
Parameters
$username
string
The HTTP username
Exceptions
\Zend_Uri_Exception |
When $username is not a valid HTTP username |
Returns
string
Validate the current URI from the instance variables. Returns true if and only if all
parts pass validation.
valid() : boolean
inherited_from |
\Zend_Uri::valid() |
Returns
boolean
Returns TRUE if this URI is valid, or FALSE otherwise.
valid() : boolean
Inherited
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.
validateFragment(string $fragment = null
) : boolean
Parameters
$fragment
string
Fragment of an URI
Exceptions
\Zend_Uri_Exception |
When fragment validation fails |
Returns
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.
validateHost(string $host = null
) : boolean
Parameters
$host
string
The HTTP host
Returns
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.
validatePassword(string $password = null
) : boolean
Parameters
$password
string
The HTTP password
Exceptions
\Zend_Uri_Exception |
When password validation fails |
Returns
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.
validatePath(string $path = null
) : boolean
Parameters
$path
string
The HTTP path
Exceptions
\Zend_Uri_Exception |
When path validation fails |
Returns
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.
validatePort(string $port = null
) : boolean
Parameters
$port
string
The HTTP port
Returns
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.
validateQuery(string $query = null
) : boolean
Parameters
$query
string
The query to validate
Exceptions
\Zend_Uri_Exception |
When query validation fails |
Returns
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.
validateUsername(string $username = null
) : boolean
Parameters
$username
string
The HTTP username
Exceptions
\Zend_Uri_Exception |
When username validation fails |
Returns
boolean
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)
__construct(string $scheme, string $schemeSpecific = ''
)
Use Zend_Uri::factory() to return a new Zend_Uri object.
inherited_from |
\Zend_Uri::__construct() |
Parameters
$scheme
string
The scheme of the URI
$schemeSpecific
string
The scheme-specific part of the URI
Exceptions
\Zend_Uri_Exception |
When the URI is not valid |
Zend_Uri and its subclasses cannot be instantiated directly.
__construct(string $scheme, string $schemeSpecific = ''
)
Inherited
Use Zend_Uri::factory() to return a new Zend_Uri object.
Parameters
$scheme
string
The scheme of the URI
$schemeSpecific
string
The scheme-specific part of the URI
Parse the scheme-specific portion of the URI and place its parts into instance variables.
_parseUri(string $schemeSpecific) : void
Parameters
$schemeSpecific
string
The scheme-specific portion to parse
Exceptions
\Zend_Uri_Exception |
When scheme-specific decoposition fails |
\Zend_Uri_Exception |
When authority decomposition fails |
Properties
Global configuration array
$_config : array
Default
array('allow_unwise' => false)
Static
HTTP fragment
$_fragment : string
HTTP host
$_host : string
HTTP password
$_password : string
HTTP part
$_path : string
HTTP post
$_port : string
HTTP query
$_query : string
Regular expression grammar rules for validation; values added by constructor
$_regex : array
Scheme of this URI (http, ftp, etc.)
$_scheme : string
HTTP username
$_username : string
Constants
Character classes for validation regular expressions
CHAR_ALNUM = 'A-Za-z0-9'
CHAR_MARK
CHAR_MARK = '-_.!~*\'()\[\]'
CHAR_RESERVED
CHAR_RESERVED = ';\/?:@&=+$,'
CHAR_SEGMENT
CHAR_SEGMENT = ':@&=+$,;'
CHAR_UNWISE
CHAR_UNWISE = '{}|\\\\^`'