StrategyInterface::getExceptionHandler()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace League\Route\Strategy;
4
5
use Exception;
6
use League\Route\Http\Exception\{MethodNotAllowedException, NotFoundException};
7
use League\Route\Route;
8
use Psr\Http\Message\{ResponseInterface, ServerRequestInterface};
9
use Psr\Http\Server\MiddlewareInterface;
10
11
interface StrategyInterface
12
{
13
    /**
14
     * Invoke the route callable based on the strategy
15
     *
16
     * @param Route                  $route
17
     * @param ServerRequestInterface $request
18
     *
19
     * @return ResponseInterface
20
     */
21
    public function invokeRouteCallable(Route $route, ServerRequestInterface $request): ResponseInterface;
22
23
    /**
24
     * Get a middleware that will decorate a NotFoundException
25
     *
26
     * @param NotFoundException $exception
27
     *
28
     * @return MiddlewareInterface
29
     */
30
    public function getNotFoundDecorator(NotFoundException $exception): MiddlewareInterface;
31
32
    /**
33
     * Get a middleware that will decorate a NotAllowedException
34
     *
35
     * @param MethodNotAllowedException $exception
36
     *
37
     * @return MiddlewareInterface
38
     */
39
    public function getMethodNotAllowedDecorator(MethodNotAllowedException $exception): MiddlewareInterface;
40
41
    /**
42
     * Get a middleware that will act as an exception handler
43
     *
44
     * The middleware must wrap the rest of the middleware stack and catch any
45
     * thrown exceptions.
46
     *
47
     * @return MiddlewareInterface
48
     */
49
    public function getExceptionHandler(): MiddlewareInterface;
50
51
    /**
52
     * Get a middleware that acts as a throwable handler, it should wrap the rest of the
53
     * middleware stack and catch any throwables.
54
     *
55
     * @return MiddlewareInterface
56
     */
57
    public function getThrowableHandler(): MiddlewareInterface;
58
}
59