\Gishiki\Core\MVC\Controller\PluginsRequestDeserializer

This is a plugin used to parse data transported by the HTTP request.

Summary

Methods
Properties
Constants
__construct()
getResponse()
getRequest()
registerMediaTypeParser()
getRequestContentType()
getRequestMediaType()
getRequestDeserialized()
No public properties found
No constants found
No protected methods found
$request
$response
$application
$bodyParsers
N/A
No private methods found
No private properties found
N/A

Properties

$request

$request : \Psr\Http\Message\RequestInterface

Type

\Psr\Http\Message\RequestInterface — reference to the HTTP request

$response

$response : \Psr\Http\Message\ResponseInterface

Type

\Psr\Http\Message\ResponseInterface — reference to the HTTP response

$application

$application : \Gishiki\Core\Application|null

Type

\Gishiki\Core\Application|null — the application current instance

$bodyParsers

$bodyParsers : array<mixed,\Callable>

List of request body parsers (e.g., url-encoded, JSON, XML, multipart).

Type

array<mixed,\Callable>

Methods

__construct()

__construct(\Psr\Http\Message\RequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response, \Gishiki\Core\Application|null  $app = null) 

Deserializer constructor: setup the middleware importing deserializers

Warning: you should never attempt to use another construction in your plugin, unless it calls parent::__construct()

Parameters

\Psr\Http\Message\RequestInterface $request

the HTTP request

\Psr\Http\Message\ResponseInterface $response

the HTTP response

\Gishiki\Core\Application|null $app

the current application instance

getResponse()

getResponse() : \Psr\Http\Message\ResponseInterface

Get the HTTP response.

Returns

\Psr\Http\Message\ResponseInterface —

the HTTP response

getRequest()

getRequest() : \Psr\Http\Message\RequestInterface

Get the HTTP request.

Returns

\Psr\Http\Message\RequestInterface —

the HTTP request

registerMediaTypeParser()

registerMediaTypeParser(array<mixed,string>  $mediaTypes, callable  $callable) 

Register media type parser.

Parameters

array<mixed,string> $mediaTypes

A HTTP media type (excluding content-type params)

callable $callable

A callable that returns parsed contents for media type

getRequestContentType()

getRequestContentType() : string|null

Get request content type.

Note: This method is not part of the PSR-7 standard.

Returns

string|null —

The request content type, if known

getRequestMediaType()

getRequestMediaType() : string|null

Get request media type, if known.

Note: This method is not part of the PSR-7 standard.

Returns

string|null —

The request media type, minus content-type params

getRequestDeserialized()

getRequestDeserialized() : \Gishiki\Algorithms\Collections\SerializableCollection

Retrieve any parameters provided in the request body.

If the request Content-Type is either application/x-www-form-urlencoded or multipart/form-data, and the request method is POST, this method MUST return the contents of $_POST.

Otherwise, this method may return any results of deserializing the request body content.

Throws

\Gishiki\Core\MVC\Controller\ControllerException

if the request body is invalid

Returns

\Gishiki\Algorithms\Collections\SerializableCollection

The deserialized body parameters, if any. These will typically be an array or object