PHP Класс Respect\Rest\Request

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$method The HTTP method (commonly GET, POST, PUT, DELETE, HEAD)
$params A numeric array containing valid URL parameters. For a route path like /users/*, a Request for /users/alganet should have an array equivalent to ['alganet']
$route A route matched for this request
$uri The called URI

Открытые методы

Метод Описание
__construct ( string $method = null, string $uri = null )
__toString ( ) Converting this request to string dispatch
forward ( Respect\Rest\Routes\AbstractRoute $route ) : Response Forwards a route
response ( ) : string Generates and returns the response from the current route
routineCall ( string $type, string $method, Respect\Rest\Routines\Routinable $routine, array &$params ) : mixed Calls a routine on the current route and returns its result

Защищенные методы

Метод Описание
catchExceptions ( Exception $e ) : mixed Does a catch-like operation on an exception based on previously declared instances from Router::exceptionRoute
extractRouteParam ( ReflectionFunctionAbstract $callback, ReflectionParameter $routeParam, array &$params ) : mixed Extracts a parameter value from the current route
forwardErrors ( mixed $errorHandler ) : mixed Restores the previous error handler if present then check error routes for logged errors, forwarding them or returning null silently
prepareForErrorForwards ( ) : mixed Declares an error handler for a single Router::errorRoute instance on the fly before dispatching the request, so the application can capture the errors. These are cleaned after dispatching by forwardErrors()
processPosRoutines ( $response ) : mixed Iterates over routines to find instances of Respect\Rest\Routines\ProxyableThrough and call them, forwarding if necessary
processPreRoutines ( ) : mixed Iterates over routines to find instances of Respect\Rest\Routines\ProxyableBy and call them, forwarding if necessary

Описание методов

__construct() публичный Метод

public __construct ( string $method = null, string $uri = null )
$method string The HTTP method
$uri string The called URI

__toString() публичный Метод

Converting this request to string dispatch
public __toString ( )

catchExceptions() защищенный Метод

Does a catch-like operation on an exception based on previously declared instances from Router::exceptionRoute
protected catchExceptions ( Exception $e ) : mixed
$e Exception Any exception
Результат mixed A route forwarding or a silent null

extractRouteParam() защищенный Метод

Extracts a parameter value from the current route
protected extractRouteParam ( ReflectionFunctionAbstract $callback, ReflectionParameter $routeParam, array &$params ) : mixed
$callback ReflectionFunctionAbstract Any function reflection
$routeParam ReflectionParameter Any parameter reflection
$params array Request URI params
Результат mixed a value from the reflected param

forward() публичный Метод

Forwards a route
public forward ( Respect\Rest\Routes\AbstractRoute $route ) : Response
$route Respect\Rest\Routes\AbstractRoute Any route
Результат Response from the forwarded route

forwardErrors() защищенный Метод

Restores the previous error handler if present then check error routes for logged errors, forwarding them or returning null silently
protected forwardErrors ( mixed $errorHandler ) : mixed
$errorHandler mixed Some error handler (internal or external to Respect)
Результат mixed A route forwarding or a silent null

prepareForErrorForwards() защищенный Метод

Declares an error handler for a single Router::errorRoute instance on the fly before dispatching the request, so the application can capture the errors. These are cleaned after dispatching by forwardErrors()
См. также: Respect\Rest\Request::forwardErrors
См. также: http://php.net/set_error_handler
protected prepareForErrorForwards ( ) : mixed
Результат mixed The previous error handler

processPosRoutines() защищенный Метод

Iterates over routines to find instances of Respect\Rest\Routines\ProxyableThrough and call them, forwarding if necessary
См. также: Respect\Rest\Routines\ProxyableThrough
См. также: Respect\Rest\Request::routineCall
protected processPosRoutines ( $response ) : mixed
Результат mixed A route forwarding or false

processPreRoutines() защищенный Метод

Iterates over routines to find instances of Respect\Rest\Routines\ProxyableBy and call them, forwarding if necessary
См. также: Respect\Rest\Routines\ProxyableBy
См. также: Respect\Rest\Request::routineCall
protected processPreRoutines ( ) : mixed
Результат mixed A route forwarding or false

response() публичный Метод

Generates and returns the response from the current route
public response ( ) : string
Результат string A response!

routineCall() публичный Метод

Calls a routine on the current route and returns its result
public routineCall ( string $type, string $method, Respect\Rest\Routines\Routinable $routine, array &$params ) : mixed
$type string The name of the routine (accept, when, etc)
$method string The method name (GET, HEAD, POST, etc)
$routine Respect\Rest\Routines\Routinable Some routine instance
$params array Params from the routine
Результат mixed Whatever the routine returns

Описание свойств

$method публичное свойство

The HTTP method (commonly GET, POST, PUT, DELETE, HEAD)
public $method

$params публичное свойство

A numeric array containing valid URL parameters. For a route path like /users/*, a Request for /users/alganet should have an array equivalent to ['alganet']
public $params

$route публичное свойство

A route matched for this request
public $route

$uri публичное свойство

The called URI
public $uri