Zend Framework  3.0
Public Member Functions | List of all members
ServerRequest Class Reference

Server-side HTTP request. More...

Public Member Functions

 __construct (array $serverParams=[], array $uploadedFiles=[], $uri=null, $method=null, $body= 'php://input', array $headers=[], array $cookies=[], array $queryParams=[], $parsedBody=null, $protocol= '1.1')
 
 getServerParams ()
 {}
 
 getUploadedFiles ()
 {}
 
 withUploadedFiles (array $uploadedFiles)
 {}
 
 getCookieParams ()
 {}
 
 withCookieParams (array $cookies)
 {}
 
 getQueryParams ()
 {}
 
 withQueryParams (array $query)
 {}
 
 getParsedBody ()
 {}
 
 withParsedBody ($data)
 {}
 
 getAttributes ()
 {}
 
 getAttribute ($attribute, $default=null)
 {}
 
 withAttribute ($attribute, $value)
 {}
 
 withoutAttribute ($attribute)
 {}
 
 getMethod ()
 Proxy to receive the request method.
 
 withMethod ($method)
 Set the request method.
 

Detailed Description

Server-side HTTP request.

Extends the Request definition to add methods for accessing incoming data, specifically server parameters, cookies, matched path parameters, query string arguments, body parameters, and upload file information.

"Attributes" are discovered via decomposing the request (and usually specifically the URI path), and typically will be injected by the application.

Requests are considered immutable; all methods that might change state are implemented such that they retain the internal state of the current message and return a new instance that contains the changed state.

Constructor & Destructor Documentation

__construct ( array  $serverParams = [],
array  $uploadedFiles = [],
  $uri = null,
  $method = null,
  $body = 'php://input',
array  $headers = [],
array  $cookies = [],
array  $queryParams = [],
  $parsedBody = null,
  $protocol = '1.1' 
)
Parameters
array$serverParamsServer parameters, typically from $_SERVER
array$uploadedFilesUpload file information, a tree of UploadedFiles
null | string$uriURI for the request, if any.
null | string$methodHTTP method for the request, if any.
string | resource | StreamInterface$bodyMessage body, if any.
array$headersHeaders for the message, if any.
array$cookiesCookies for the message, if any.
array$queryParamsQuery params for the message, if any.
null | array | object$parsedBodyThe deserialized body parameters, if any.
string$protocolHTTP protocol version.
Exceptions
InvalidArgumentExceptionfor any invalid value.

Member Function Documentation

getAttribute (   $attribute,
  $default = null 
)

{}

getAttributes ( )

{}

getCookieParams ( )

{}

getMethod ( )

Proxy to receive the request method.

This overrides the parent functionality to ensure the method is never empty; if no method is present, it returns 'GET'.

Returns
string
getParsedBody ( )

{}

getQueryParams ( )

{}

getServerParams ( )

{}

getUploadedFiles ( )

{}

withAttribute (   $attribute,
  $value 
)

{}

withCookieParams ( array  $cookies)

{}

withMethod (   $method)

Set the request method.

Unlike the regular Request implementation, the server-side normalizes the method to uppercase to ensure consistency and make checking the method simpler.

This methods returns a new instance.

Parameters
string$method
Returns
self
withoutAttribute (   $attribute)

{}

withParsedBody (   $data)

{}

withQueryParams ( array  $query)

{}

withUploadedFiles ( array  $uploadedFiles)

{}