1 | <?php |
||
23 | class Route |
||
24 | { |
||
25 | /** |
||
26 | * @var string The identifier of this route |
||
27 | */ |
||
28 | private $identifier; |
||
29 | |||
30 | /** |
||
31 | * @var string The verb of this route |
||
32 | */ |
||
33 | private $verb; |
||
34 | |||
35 | /** |
||
36 | * @var callable The callback to execute when this route matches |
||
37 | */ |
||
38 | private $callback; |
||
39 | |||
40 | /** |
||
41 | * Creates instance |
||
42 | * |
||
43 | * @param string $identifier The identifier of this route |
||
44 | * @param string $verb The verb of this route |
||
45 | * @param callable $callback The callback to execute when this route matches |
||
46 | */ |
||
47 | 5 | public function __construct($identifier, $verb, callable $callback) |
|
53 | |||
54 | /** |
||
55 | * Checks whether the current request matches the route |
||
56 | * |
||
57 | * @param string $identifier The identifier of this route |
||
58 | * @param string $verb The verb of this route |
||
59 | */ |
||
60 | 4 | public function matchesRequest($identifier, $verb) |
|
64 | |||
65 | /** |
||
66 | * Runs the route |
||
67 | * |
||
68 | * @return mixed The result of the callback |
||
69 | */ |
||
70 | 1 | public function run() |
|
76 | } |
||
77 |