1 <?php
2
3 /*
4 * This file is part of the ICanBoogie package.
5 *
6 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace ICanBoogie\HTTP;
13
14 /**
15 * Dispatcher interface.
16 */
17 interface DispatcherInterface
18 {
19 /**
20 * Process the request.
21 *
22 * @param Request $request
23 *
24 * @return Response A response to the request.
25 */
26 public function __invoke(Request $request);
27
28 /**
29 * Rescues the exception that was thrown during the request process.
30 *
31 * @param \Exception $exception
32 * @param Request $request
33 *
34 * @return Response A response to the request exception.
35 *
36 * @throws \Exception when the request exception cannot be rescued.
37 */
38 public function rescue(\Exception $exception, Request $request);
39 }
40