Methods summary
public
|
#
__construct( array $options = array() )
Constructor
Parameters
Throws
InvalidArgumentException When option "wei" is not an instance of "Wei\Wei"
Overrides
|
public
string|null
|
#
__invoke( string $name, mixed $default = '' )
Returns a stringify or user defined($default) parameter value
Returns a stringify or user defined($default) parameter value
Parameters
- $name
- The parameter name
- $default
- The default parameter value if the parameter does not exist
Returns
string|null The parameter value
|
public
string|null
|
#
get( string $name, mixed $default = null )
Returns a stringify or user defined($default) parameter value
Returns a stringify or user defined($default) parameter value
Parameters
- $name
- The parameter name
- $default
- The default parameter value if the parameter does not exist
Returns
string|null The parameter value
|
public
integer
|
#
getInt( string $name, integer|null $min = null, integer|null $max = null )
Returns a integer value in the specified range
Returns a integer value in the specified range
Parameters
- $name
- The parameter name
- $min
- The min value for the parameter
- $max
- The max value for the parameter
Returns
integer The parameter value
|
public
mixed
|
#
getInArray( string $name, array $array )
Returns a parameter value in the specified array, if not in, returns the
first element instead
Returns a parameter value in the specified array, if not in, returns the
first element instead
Parameters
- $name
- The parameter name
- $array
- The array to be search
Returns
mixed The parameter value
|
public
|
#
set( string|array $name, mixed $value = null )
Set parameter value
Parameters
- $name
- The parameter name or A key-value array
- $value
- The parameter value
Returns
$this
|
public
|
#
remove( string $name )
Remove parameter by specified name
Remove parameter by specified name
Parameters
Returns
$this
|
public
|
#
clear( )
Clear all parameter data
Returns
$this
|
public
boolean
|
#
offsetExists( string $offset )
Check if the offset exists
Check if the offset exists
Parameters
Returns
boolean
Implementation of
ArrayAccess::offsetExists()
|
public
mixed
&
|
#
offsetGet( string $offset )
Get the offset value
Parameters
Returns
mixed
Implementation of
ArrayAccess::offsetGet()
|
public
mixed
|
#
offsetSet( string $offset, mixed $value )
Set the offset value
Parameters
Returns
mixed
Implementation of
ArrayAccess::offsetSet()
|
public
|
#
offsetUnset( string $offset )
Unset the offset
Parameters
Implementation of
ArrayAccess::offsetUnset()
|
public
|
#
fromArray( array $array = array() )
Merge data from array
Parameters
Returns
$this
|
public
array
|
#
toArray( )
Return the source array of the object
Return the source array of the object
Returns
array
|
public
integer
|
#
count( )
Return the length of data
Return the length of data
Returns
integer the length of data
Implementation of
Countable::count()
|
public
string
|
#
getScheme( )
Returns the request scheme
Returns the request scheme
Returns
string
|
public
string
|
#
getHost( )
Returns the request host
Returns
string
|
public
Wei\Request
|
#
setRequestUri( string $requestUri )
Set the request URI.
Parameters
Returns
|
public
string
|
|
public
Wei\Request
|
#
setBaseUrl( string $baseUrl )
Set the base URL.
Parameters
Returns
|
public
string
|
|
public
|
#
setPathInfo( string $pathInfo )
Set the path info
Parameters
Returns
$this
|
public
string
|
|
public
string
|
#
getUrl( )
Returns the full URL, which contains scheme://domain[:port]/[baseUrl][PathInfo][?queryString]
Returns the full URL, which contains scheme://domain[:port]/[baseUrl][PathInfo][?queryString]
The full URL do not contain the fragment, for it never sent to the server
Returns
string
|
public
string
|
#
getSchemeAndHost( )
Returns scheme and host which contains scheme://domain[:port]
Returns scheme and host which contains scheme://domain[:port]
Returns
string
|
public
string
|
#
getUrlFor( string $path )
Generates absolute URL for specified path
Generates absolute URL for specified path
Parameters
Returns
string
|
public
string
|
#
getIp( string $default = '0.0.0.0' )
Returns the client IP address
Returns the client IP address
If the IP could not receive from the server parameter, or the IP address
is not valid, return the $default value instead
Parameters
- $default
- The default ip address
Returns
string
Link
|
public
string
|
#
getMethod( )
Returns the HTTP request method
Returns the HTTP request method
Returns
string
|
public
|
#
setMethod( string $method )
Set the HTTP request method
Set the HTTP request method
Parameters
- $method
- The value of method
Returns
$this
|
public
boolean
|
#
isMethod( string $method )
Check if the current request method is the specified string
Check if the current request method is the specified string
Parameters
- $method
- The method name to be compared
Returns
boolean
|
public
boolean
|
#
isGet( )
Check if the current request method is GET
Check if the current request method is GET
Returns
boolean
|
public
boolean
|
#
isPost( )
Check if the current request method is POST
Check if the current request method is POST
Returns
boolean
|
public
boolean
|
#
isAjax( )
Check if the current request is an ajax(XMLHttpRequest) request
Check if the current request is an ajax(XMLHttpRequest) request
Returns
boolean
|
public
array
&
|
#
getParameterReference( string $type )
Returns the HTTP parameters reference
Returns the HTTP parameters reference
Parameters
- $type
- The parameter type, could be get, post, cookie, or server
Returns
array The parameters array
Throws
InvalidArgumentException When parameter type is unknown
|
public
string
|
#
getContent( )
Returns the request message body
Returns the request message body
Returns
string
|
public
|
#
setContent( string $content )
Set the request message body
Set the request message body
Parameters
Returns
$this
|
public
string
|
#
__toString( )
Returns the request message string
Returns the request message string
Returns
string
|
public
mixed
|
#
getServer( string $name, mixed $default = null )
Return the server and execution environment parameter value ($_SERVER)
Return the server and execution environment parameter value ($_SERVER)
Parameters
- $name
- The name of parameter
- $default
- The default parameter value if the parameter does not exist
Returns
mixed
|
public
|
#
setServer( string $name, string $value )
Set the server and execution environment parameter value ($_SERVER)
Set the server and execution environment parameter value ($_SERVER)
Parameters
Returns
$this
|
public
mixed
|
#
getQuery( string $name, mixed $default = null )
Return the URL query parameter value ($_GET)
Return the URL query parameter value ($_GET)
Parameters
- $name
- The name of parameter
- $default
- The default parameter value if the parameter does not exist
Returns
mixed
|
public
|
#
setQuery( string $name, string $value )
Set the URL query parameter value ($_GET)
Set the URL query parameter value ($_GET)
Parameters
Returns
$this
|
public
array
&
|
#
getQueries( )
Return the URL query parameter values ($_GET)
Return the URL query parameter values ($_GET)
Returns
array
|
public
mixed
|
#
getPost( string $name, mixed $default = null )
Return the HTTP request parameters value ($_POST)
Return the HTTP request parameters value ($_POST)
Parameters
- $name
- The name of parameter
- $default
- The default parameter value if the parameter does not exist
Returns
mixed
|
public
|
#
setPost( string $name, string $value )
Set the HTTP request parameters value ($_POST)
Set the HTTP request parameters value ($_POST)
Parameters
Returns
$this
|
public
boolean
|
#
isPage( string $page )
Check if the request page is specified page
Check if the request page is specified page
Parameters
Returns
boolean
|
protected
string
|
#
detectRequestUri( )
Detect the base URI for the request
Detect the base URI for the request
Looks at a variety of criteria in order to attempt to autodetect a base
URI, including rewrite URIs, proxy URIs, etc.
Returns
string
|
protected
string
|
#
detectBaseUrl( )
Auto-detect the base path from the request environment
Auto-detect the base path from the request environment
Uses a variety of criteria in order to detect the base URL of the request
(i.e., anything additional to the document root).
The base URL includes the schema, host, and port, in addition to the path.
Returns
string
|
protected
string
|
#
detectPathInfo( )
Detect the path info for the request
Detect the path info for the request
Returns
string
|
public
ArrayIterator
|
#
getIterator( )
Retrieve an array iterator
Retrieve an array iterator
Returns
ArrayIterator
Implementation of
IteratorAggregate::getIterator()
|
public
boolean
|
#
accept( string $mine )
Check if the accept header is starts with the specified MIME type
Check if the accept header is starts with the specified MIME type
Parameters
Returns
boolean
|
public
boolean
|
#
acceptJson( )
Check if the request is accept a JSON response
Check if the request is accept a JSON response
Returns
boolean
|
Properties summary
protected
array
|
$data
The request parameters, equals to $_REQUEST when $fromGlobal is true
The request parameters, equals to $_REQUEST when $fromGlobal is true
|
|
protected
array
|
$gets
The URL query parameters, equal to $_GET when $fromGlobal is true
The URL query parameters, equal to $_GET when $fromGlobal is true
|
|
protected
array
|
$posts
The HTTP request parameters, equal to $_POST when $fromGlobal is true
The HTTP request parameters, equal to $_POST when $fromGlobal is true
|
|
protected
array
|
$cookies
The cookie parameters, equal to $_COOKIE when $fromGlobal is true
The cookie parameters, equal to $_COOKIE when $fromGlobal is true
|
|
protected
array
|
$servers
The server parameters, equal to $_SERVER when $fromGlobal is true
The server parameters, equal to $_SERVER when $fromGlobal is true
|
|
protected
array
|
$files
The upload file parameters, equal to $_FILES when $fromGlobal is true
The upload file parameters, equal to $_FILES when $fromGlobal is true
|
|
protected
string
|
$content
|
|
protected
boolean
|
$fromGlobal
Whether create request parameter from PHP global variable
Whether create request parameter from PHP global variable
|
|
protected
boolean
|
$overwriteMethod
Whether overwrite the request method when "_method" request parameter is present
Whether overwrite the request method when "_method" request parameter is present
|
|
protected
boolean
|
$overwriteAjax
Whether add "X-Requested-With: XMLHttpRequest" header when "_ajax" request parameter is present
Whether add "X-Requested-With: XMLHttpRequest" header when "_ajax" request parameter is present
|
|
protected
boolean
|
$overwriteFormat
Whether allow detect accept MIME type by "_format" request parameter
Whether allow detect accept MIME type by "_format" request parameter
|
|
protected
string
|
$baseUrl
|
|
protected
string
|
$pathInfo
|
|
protected
string
|
$requestUri
|
|
protected
string
|
$method
|
|