for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of coisa/http.
*
* (c) Felipe Sayão Lobato Abreu <[email protected]>
* This source file is subject to the license that is bundled
* with this source code in the file LICENSE.
*/
declare(strict_types=1);
namespace CoiSA\Http\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
* Class RequestHandlerMiddleware
* @package CoiSA\Http\Middleware
final class RequestHandlerMiddleware implements RequestHandlerInterface, MiddlewareInterface
{
* @var RequestHandlerInterface
private $handler;
* MiddlewareAggregator constructor.
* @param RequestHandlerInterface $handler
public function __construct(RequestHandlerInterface $handler)
$this->handler = $handler;
}
* @param ServerRequestInterface $request
* @return ResponseInterface
public function handle(ServerRequestInterface $request): ResponseInterface
return $this->handler->handle($request);
* {@inheritdoc}
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
$response = $this->handle($request);
$handler->handle($request);
return $response;