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\Routing;
13
14 use ICanBoogie\HTTP\Request;
15 use ICanBoogie\Route;
16
17 /**
18 * A route controller.
19 */
20 abstract class Controller
21 {
22 /**
23 * The route to control.
24 *
25 * @var Route
26 */
27 protected $route;
28
29 /**
30 * Initializes the {@link $route} property.
31 *
32 * @param Route $route The route to control.
33 */
34 public function __construct(Route $route)
35 {
36 $this->route = $route;
37 }
38
39 /**
40 * Controls the route and returns a response.
41 *
42 * @param Request $request
43 *
44 * @return \ICanBoogie\HTTP\Response
45 */
46 abstract public function __invoke(Request $request);
47 }