PHP Class Scalr\Api\Rest\Http\Request

Since: 5.4.0 (09.02.2015)
Author: Vitaliy Demidov ([email protected])
Show file Open project: scalr/scalr Class Usage Examples

Protected Properties

Property Type Description
$formDataMediaTypes
$jsonDataMediaTypes

Public Methods

Method Description
__construct ( Scalr\Api\Rest\Environment $appEnv ) Constructor
delete ( string $key = null, string $default = null ) : mixed Gets DELETE data
get ( string $key = null, string $default = null ) : mixed Gets GET data
getBody ( ) : string Gets request raw body
getContentLength ( ) : integer Gets Content length
getContentType ( ) : string | null Gets Content Type
getHost ( ) : string Gets server host
getIp ( ) : string | null Gets IP address
getJsonBody ( ) : mixed Gets request's json decoded body
getMediaType ( ) : string | null Gets media type
getMediaTypeParams ( ) : array Gets media type parameters
getMethod ( ) : string Gets HTTP Request method
getOrigin ( ) : string | null Gets HTTP origin
getPath ( ) : string Gets path
getPathInfo ( ) : string Gets path info
getPort ( ) : number Gets server port
getReferer ( ) : string | null Gets HTTP Referer
getScheme ( ) : string Gets scheme
getScriptName ( ) : string Gets script name
getUrl ( ) : string Gets URL
getUserAgent ( ) : string | null Gets User Agent
hasMethod ( string $method ) : boolean Checks whether specified method is accepted for the request
headers ( string $key = null, string $default = null ) : string Gets header
isFormData ( ) : boolean Whether content type is application/x-www-form-urlencoded
isJsonData ( ) : boolean Whether content type is application/json
patch ( string $key = null, string $default = null ) : mixed Gets PATCH data
post ( string $key = null, string $default = null ) : mixed Gets POST data
put ( string $key = null, string $default = null ) : mixed Gets PUT data

Method Details

__construct() public method

Constructor
public __construct ( Scalr\Api\Rest\Environment $appEnv )
$appEnv Scalr\Api\Rest\Environment Application environment variables

delete() public method

Gets DELETE data
public delete ( string $key = null, string $default = null ) : mixed
$key string optional Variable name
$default string optional Default value for the variable
return mixed Returns variable value

get() public method

Gets GET data
public get ( string $key = null, string $default = null ) : mixed
$key string optional Variable name
$default string optional Default value for the variable
return mixed Returns variable value

getBody() public method

Gets request raw body
public getBody ( ) : string
return string Returns request raw body

getContentLength() public method

Gets Content length
public getContentLength ( ) : integer
return integer Returns content length

getContentType() public method

Gets Content Type
public getContentType ( ) : string | null
return string | null

getHost() public method

Gets server host
public getHost ( ) : string
return string Returns server host

getIp() public method

Gets IP address
public getIp ( ) : string | null
return string | null Returns IP address

getJsonBody() public method

Gets request's json decoded body
public getJsonBody ( ) : mixed
return mixed Returns json decoded body

getMediaType() public method

Gets media type
public getMediaType ( ) : string | null
return string | null Returns media type

getMediaTypeParams() public method

Gets media type parameters
public getMediaTypeParams ( ) : array
return array Returns media type parameters

getMethod() public method

Gets HTTP Request method
public getMethod ( ) : string
return string Returns HTTP Request method

getOrigin() public method

Gets HTTP origin
public getOrigin ( ) : string | null
return string | null

getPath() public method

Gets path
public getPath ( ) : string
return string Returns path

getPathInfo() public method

Gets path info
public getPathInfo ( ) : string
return string Returns path info

getPort() public method

Gets server port
public getPort ( ) : number
return number Returns server port

getReferer() public method

Gets HTTP Referer
public getReferer ( ) : string | null
return string | null Gets HTTP Referer

getScheme() public method

Gets scheme
public getScheme ( ) : string
return string Returns scheme (http or https)

getScriptName() public method

Gets script name
public getScriptName ( ) : string
return string Returns script name

getUrl() public method

Gets URL
public getUrl ( ) : string
return string Returns URL

getUserAgent() public method

Gets User Agent
public getUserAgent ( ) : string | null
return string | null Returns User Agent

hasMethod() public static method

Checks whether specified method is accepted for the request
public static hasMethod ( string $method ) : boolean
$method string HTTP Method
return boolean Returns TRUE if the specified method is accepted for the request

headers() public method

Gets header
public headers ( string $key = null, string $default = null ) : string
$key string optional The header name
$default string optional Default value
return string Returns header value

isFormData() public method

Whether content type is application/x-www-form-urlencoded
public isFormData ( ) : boolean
return boolean Returns true if content type is a form data

isJsonData() public method

Whether content type is application/json
public isJsonData ( ) : boolean
return boolean Returns TRUE if content type is json

patch() public method

Gets PATCH data
public patch ( string $key = null, string $default = null ) : mixed
$key string optional Variable name
$default string optional Default value for the variable
return mixed Returns variable value

post() public method

Gets POST data
public post ( string $key = null, string $default = null ) : mixed
$key string optional Variable name
$default string optional Default value for the variable
return mixed Returns variable value

put() public method

Gets PUT data
public put ( string $key = null, string $default = null ) : mixed
$key string optional Variable name
$default string optional Default value for the variable
return mixed Returns variable value

Property Details

$formDataMediaTypes protected static property

protected static $formDataMediaTypes

$jsonDataMediaTypes protected static property

protected static $jsonDataMediaTypes