RampageRequestHandler
    
            
            in package
            
        
    
            
            implements
                            RequestHandlerInterface                    
    
    
The Rampage request handler.
Enqueue any list of middleware and optionally a payload request handler.
Each middleware a request passes may change the request details, add middleware to the bottom of the queue or cause side effects.
Calculated, loaded or derived data may be stored in a request attribute.
The list of middleware will be processed until a response is returned or the list has been consumed. In this case, a payload request handler will produce the initial Response object. If there is no payload request handler, the RampageRequestHandler itself will create a very simple response.
Once a response is returned, the response object passes back through all the previous layers and may be changed by them or cause side effects.
The final response returned by RampageRequestHandler should
Note that middlewares or the payload could themselves delegate their duties to other middlewares, handlers or other code
Table of Contents
Interfaces
- RequestHandlerInterface
Properties
- $responseFactory : ResponseFactoryInterface
- $streamFactory : StreamFactoryInterface
- $middlewares : array<string|int, MiddlewareInterface>
- $payloadHandler : RequestHandlerInterface|null
Methods
- __construct() : mixed
- Constructor
- addMiddleware() : void
- Add another middleware to the queue just before the payload handler
- handle() : ResponseInterface
- Handle a request
- nextMiddleware() : MiddlewareInterface|null
- setPayloadHandler() : void
- Configure the payload handler
Properties
$responseFactory
    protected
        ResponseFactoryInterface
    $responseFactory
    
    
    
    
    
$streamFactory
    protected
        StreamFactoryInterface
    $streamFactory
    
    
    
    
    
$middlewares
    private
        array<string|int, MiddlewareInterface>
    $middlewares
     = []
    
    
    
    
$payloadHandler
    private
        RequestHandlerInterface|null
    $payloadHandler
    
    
    
    
    
Methods
__construct()
Constructor
    public
                    __construct(ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory[, array<string|int, MiddlewareInterface> $middlewares = [] ][, RequestHandlerInterface|null $payloadHandler = null ]) : mixed
    Parameters
- $responseFactory : ResponseFactoryInterface
- $streamFactory : StreamFactoryInterface
- $middlewares : array<string|int, MiddlewareInterface> = []
- $payloadHandler : RequestHandlerInterface|null = null
addMiddleware()
Add another middleware to the queue just before the payload handler
    public
                    addMiddleware(MiddlewareInterface $middleware) : void
    Parameters
- $middleware : MiddlewareInterface
handle()
Handle a request
    public
                    handle(ServerRequestInterface $request) : ResponseInterface
    Each middleware will either create a response or return control to the handler.
If the middlewares created no response, the payload handler will.
Finally the we will return a response ourselves.
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterfacenextMiddleware()
    public
                    nextMiddleware() : MiddlewareInterface|null
    Return values
MiddlewareInterface|nullsetPayloadHandler()
Configure the payload handler
    public
                    setPayloadHandler(RequestHandlerInterface $handler) : void
    Parameters
- $handler : RequestHandlerInterface