Class ClosureDecoratorMiddleware

Decorate closures as PSR-15 middleware.

Decorates closures with the following signature:

function (
    ServerRequestInterface $request,
    RequestHandlerInterface $handler
): ResponseInterface

such that it will operate as PSR-15 middleware.

Properties summary

Method Summary

Method Detail

__construct() public

__construct(\Closure $callable)

Constructor

Parameters

\Closure $callable

A closure.

getCallable() public

getCallable()

Returns

callable

process() public

process(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Server\RequestHandlerInterface $handler)

Run the callable to process an incoming server request.

Parameters

\Psr\Http\Message\ServerRequestInterface $request

Request instance.

\Psr\Http\Server\RequestHandlerInterface $handler

Request handler instance.

Returns

\Psr\Http\Message\ResponseInterface

Property Detail

$callable protected

A Closure.

Type

\Closure

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.0/class-Cake.Http.Middleware.ClosureDecoratorMiddleware.html