for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Phoole (PHP7.2+)
*
* @category Library
* @package Phoole\Middleware
* @copyright Copyright (c) 2019 Hong Zhang
*/
declare(strict_types=1);
namespace Phoole\Middleware;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
* Handler
* Convert a middleware to a handler in the queue
class Handler implements RequestHandlerInterface
{
* @var MiddlewareInterface
private $middleware;
* @var RequestHandlerInterface
private $handler;
* @param MiddlewareInterface $middleware
* @param RequestHandlerInterface $handler
public function __construct(
MiddlewareInterface $middleware,
RequestHandlerInterface $handler
) {
$this->middleware = $middleware;
$this->handler = $handler;
}
* {@inheritDoc}
public function handle(ServerRequestInterface $request): ResponseInterface
return $this->middleware->process($request, $this->handler);