Uri/Http.php

Show: PublicProtectedPrivateinherited
Table of Contents
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.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Uri  
Version
$Id: Http.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Uri_Http

Package: Zend\Uri
HTTP(S) URI handler
Parent(s)
\Zend_Uri
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Uses
\global\Zend_Uri  

Constants

>VConstant  CHAR_ALNUM = 'A-Za-z0-9'
Character classes for validation regular expressions
>VConstant  CHAR_MARK = '-_.!~*\'()\[\]'
>VConstant  CHAR_RESERVED = ';\/?:@&=+$,'
>VConstant  CHAR_SEGMENT = ':@&=+$,;'
>VConstant  CHAR_UNWISE = '{}|\\\\^`'

Properties

>VPropertyprotectedarray $_config = array('allow_unwise' => false)
staticinherited
Global configuration array
Inherited from: \Zend_Uri::$$_config
Default valuearray('allow_unwise' => false)Details
Type
array
Inherited_from
\Zend_Uri::$$_config  
>VPropertyprotectedstring $_fragment = ''
HTTP fragment
Default value''Details
Type
string
>VPropertyprotectedstring $_host = ''
HTTP host
Default value''Details
Type
string
>VPropertyprotectedstring $_password = ''
HTTP password
Default value''Details
Type
string
>VPropertyprotectedstring $_path = ''
HTTP part
Default value''Details
Type
string
>VPropertyprotectedstring $_port = ''
HTTP post
Default value''Details
Type
string
>VPropertyprotectedstring $_query = ''
HTTP query
Default value''Details
Type
string
>VPropertyprotectedarray $_regex = array()
Regular expression grammar rules for validation; values added by constructor
Default valuearray()Details
Type
array
>VPropertyprotectedstring $_scheme = ''
inherited
Scheme of this URI (http, ftp, etc.)
Inherited from: \Zend_Uri::$$_scheme
Default value''Details
Type
string
Inherited_from
\Zend_Uri::$$_scheme  
>VPropertyprotectedstring $_username = ''
HTTP username
Default value''Details
Type
string

Methods

methodprotected__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.

Parameters
NameTypeDescription
$schemestring

The scheme of the URI

$schemeSpecificstring

The scheme-specific part of the URI

Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen the URI is not valid
methodpublic__toString() : string
inherited

Return a string representation of this URI.

Inherited from: \Zend_Uri::__toString()
Returns
TypeDescription
string
Details
See
\getUri()  
methodprotected_parseUri(string $schemeSpecific) : void

Parse the scheme-specific portion of the URI and place its parts into instance variables.

Parameters
NameTypeDescription
$schemeSpecificstring

The scheme-specific portion to parse

Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen scheme-specific decoposition fails
\Zend_Uri_ExceptionWhen authority decomposition fails
methodpublicaddReplaceQueryParameters(array $queryParams) : string

Add or replace params in the query string for the current URI, and return the old query.

Parameters
NameTypeDescription
$queryParamsarray
Returns
TypeDescription
stringOld query string
methodpubliccheck(string $uri) : boolean
staticinherited

Convenience function, checks that a $uri string is well-formed by validating it but not returning an object.

Inherited from: \Zend_Uri::check()

Returns TRUE if $uri is a well-formed URI, or FALSE otherwise.

Parameters
NameTypeDescription
$uristring

The URI to check

Returns
TypeDescription
boolean
methodpublicfactory(string $uri = 'http', string $className = null) : \Zend_Uri
staticinherited

Create a new Zend_Uri object for a URI.

Inherited from: \Zend_Uri::factory()

If building a new URI, then $uri should contain only the scheme (http, ftp, etc). Otherwise, supply $uri with the complete URI.

Parameters
NameTypeDescription
$uristring

The URI form which a Zend_Uri instance is created

$classNamestring

The name of the class to use in order to manipulate URI

Returns
TypeDescription
\Zend_Uri
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen an empty string was supplied for the scheme
\Zend_Uri_ExceptionWhen an illegal scheme is supplied
\Zend_Uri_ExceptionWhen the scheme is not supported
\Zend_Uri_ExceptionWhen $className doesn't exist or doesn't implements Zend_Uri
Details
Link
http://www.faqs.org/rfcs/rfc2396.html  
methodpublicfromString(string $uri) : \Zend_Uri_Http
static

Creates a Zend_Uri_Http from the given string

Parameters
NameTypeDescription
$uristring

String to create URI from, must start with 'http://' or 'https://'

Returns
TypeDescription
\Zend_Uri_Http
Throws
ExceptionDescription
\InvalidArgumentExceptionWhen the given $uri is not a string or does not start with http:// or https://
\Zend_Uri_ExceptionWhen the given $uri is invalid
methodpublicgetFragment() : string | false

Returns the fragment portion of the URL (after #), or FALSE if none.

Returns
TypeDescription
string | false
methodpublicgetHost() : string

Returns the domain or host IP portion of the URL, or FALSE if none.

Returns
TypeDescription
string
methodpublicgetPassword() : string

Returns the password portion of the URL, or FALSE if none.

Returns
TypeDescription
string
methodpublicgetPath() : string

Returns the path and filename portion of the URL.

Returns
TypeDescription
string
methodpublicgetPort() : string

Returns the TCP port, or FALSE if none.

Returns
TypeDescription
string
methodpublicgetQuery() : string

Returns the query portion of the URL (after ?), or FALSE if none.

Returns
TypeDescription
string
methodpublicgetQueryAsArray() : array

Returns the query portion of the URL (after ?) as a key-value-array.

If the query is empty an empty array is returned

Returns
TypeDescription
array
methodpublicgetScheme() : string | false
inherited

Get the URI's scheme

Inherited from: \Zend_Uri::getScheme()
Returns
TypeDescription
string | falseScheme or false if no scheme is set.
methodpublicgetUri() : 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.

Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen one or more parts of the URI are invalid
methodpublicgetUsername() : string

Returns the username portion of the URL, or FALSE if none.

Returns
TypeDescription
string
methodpublicremoveQueryParameters(array $queryParamKeys) : string

Remove params in the query string for the current URI, and return the old query.

Parameters
NameTypeDescription
$queryParamKeysarray
Returns
TypeDescription
stringOld query string
methodpublicsetConfig(\Zend_Config | array $config) : void
staticinherited

Set global configuration options

Inherited from: \Zend_Uri::setConfig()
Parameters
NameTypeDescription
$config\Zend_Config | array
methodpublicsetFragment(string $fragment) : string

Sets the fragment for the current URI, and returns the old fragment

Parameters
NameTypeDescription
$fragmentstring

Fragment of the current URI

Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen $fragment is not a valid HTTP fragment
methodpublicsetHost(string $host) : string

Sets the host for the current URI, and returns the old host

Parameters
NameTypeDescription
$hoststring

The HTTP host

Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen $host is nota valid HTTP host
methodpublicsetPassword(string $password) : string

Sets the password for the current URI, and returns the old password

Parameters
NameTypeDescription
$passwordstring

The HTTP password

Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen $password is not a valid HTTP password
methodpublicsetPath(string $path) : string

Sets the path for the current URI, and returns the old path

Parameters
NameTypeDescription
$pathstring

The HTTP path

Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen $path is not a valid HTTP path
methodpublicsetPort(string $port) : string

Sets the port for the current URI, and returns the old port

Parameters
NameTypeDescription
$portstring

The HTTP port

Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen $port is not a valid HTTP port
methodpublicsetQuery(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.

Parameters
NameTypeDescription
$querystring | array

The query string or array

Returns
TypeDescription
stringOld query string
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen $query is not a valid query string
methodpublicsetUsername(string $username) : string

Sets the username for the current URI, and returns the old username

Parameters
NameTypeDescription
$usernamestring

The HTTP username

Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen $username is not a valid HTTP username
methodpublicvalid() : boolean

Validate the current URI from the instance variables.

Returns true if and only if all parts pass validation.

Returns
TypeDescription
boolean
methodpublicvalidateFragment(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.

Parameters
NameTypeDescription
$fragmentstring

Fragment of an URI

Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen fragment validation fails
Details
Link
http://www.faqs.org/rfcs/rfc2396.html  
methodpublicvalidateHost(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.

Parameters
NameTypeDescription
$hoststring

The HTTP host

Returns
TypeDescription
boolean
Details
Uses
\Zend_Filter  
methodpublicvalidatePassword(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.

Parameters
NameTypeDescription
$passwordstring

The HTTP password

Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen password validation fails
Details
Link
http://www.faqs.org/rfcs/rfc2396.html  
methodpublicvalidatePath(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.

Parameters
NameTypeDescription
$pathstring

The HTTP path

Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen path validation fails
methodpublicvalidatePort(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.

Parameters
NameTypeDescription
$portstring

The HTTP port

Returns
TypeDescription
boolean
methodpublicvalidateQuery(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.

Parameters
NameTypeDescription
$querystring

The query to validate

Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen query validation fails
Details
Link
http://www.faqs.org/rfcs/rfc2396.html  
methodpublicvalidateUsername(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.

Parameters
NameTypeDescription
$usernamestring

The HTTP username

Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Uri_ExceptionWhen username validation fails
Details
Link
http://www.faqs.org/rfcs/rfc2396.html  
Documentation was generated by phpDocumentor 2.0.0a12.