This class will decorate a RequestHandlerInterface instance such that it can act as either a request handler or middleware. When either handle() or process() are called, the class will instead proxy to the composed handler's handle() method, returning the result.
This can be useful for decorating request handlers to use within pipelines.
(Planned usage is within zend-expressive to allow decorating request handlers as middleware before piping to a pipeline or passing to a Route instance, and within zend-expressive-router, to decorate handlers as middleware within the constructor, so that getMiddleware() can return a single type.)
This class will decorate a
RequestHandlerInterface
instance such that it can act as either a request handler or middleware. When eitherhandle()
orprocess()
are called, the class will instead proxy to the composed handler'shandle()
method, returning the result.This can be useful for decorating request handlers to use within pipelines.
(Planned usage is within zend-expressive to allow decorating request handlers as middleware before piping to a pipeline or passing to a
Route
instance, and within zend-expressive-router, to decorate handlers as middleware within the constructor, so thatgetMiddleware()
can return a single type.)