Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Core\Bootstrap\Dispatcher;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11use Psr\Http\Message\ResponseInterface;
12use Psr\Http\Message\ServerRequestInterface;
13
14/**
15 * Interface for modular domain route dispatchers.
16 *
17 * Each dispatcher handles a cohesive set of routes for a specific subsystem or domain.
18 */
19interface ModuleRouteDispatcherInterface
20{
21    /**
22     * Checks if this dispatcher can handle the given path.
23     *
24     * @param string $path HTTP request URI path.
25     * @return bool True if this dispatcher matches the path.
26     */
27    public function canDispatch(string $path): bool;
28
29    /**
30     * Dispatches the request and returns the HTTP response.
31     *
32     * @param string $path HTTP request URI path.
33     * @param ServerRequestInterface $request HTTP server request.
34     * @return ResponseInterface|null Handled response or null if passed through.
35     */
36    public function dispatch(string $path, ServerRequestInterface $request): ?ResponseInterface;
37}