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

Iterate a queue of middlewares and execute them. More...

Public Member Functions

 __construct (SplQueue $queue, callable $done)
 Constructor.
 
 __invoke (ServerRequestInterface $request, ResponseInterface $response, $err=null)
 Call the next Route in the queue.
 

Detailed Description

Iterate a queue of middlewares and execute them.

Constructor & Destructor Documentation

__construct ( SplQueue  $queue,
callable  $done 
)

Constructor.

Clones the queue provided to allow re-use.

Parameters
SplQueue$queue
callable$done

Member Function Documentation

__invoke ( ServerRequestInterface  $request,
ResponseInterface  $response,
  $err = null 
)

Call the next Route in the queue.

Next requires that a request and response are provided; these will be passed to any middleware invoked, including the $done callable, if invoked.

If the $err value is not null, the invocation is considered to be an error invocation, and Next will search for the next error middleware to dispatch, passing it $err along with the request and response.

Once dispatch is complete, if the result is a response instance, that value will be returned; otherwise, the currently registered response instance will be returned.

Parameters
ServerRequestInterface$request
ResponseInterface$response
null | mixed$err
Returns
ResponseInterface