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 [email protected] so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Uri  
Version
$Id$  

\Zend_Uri_Http

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

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

>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 $_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)

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