aboutsummaryrefslogtreecommitdiff
path: root/src/Middleware/MiddlewareInterface.php
blob: 3d21a3f96923cf92bfb3ea638dca09d870021bee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

declare(strict_types=1);

namespace BrettParson\MiniRoute\Middleware;

use BrettParson\MiniRoute\Http\RequestInterface;
use BrettParson\MiniRoute\Http\ResponseInterface;

interface MiddlewareInterface
{
    /**
     * Process the request and either short-circuit with a Response or pass
     * control to $next.
     *
     * Middleware may wrap $next to post-process the response.
     *
     * @param callable(RequestInterface): ResponseInterface $next
     */
    public function handle(RequestInterface $request, callable $next): ResponseInterface;
}