1 | <?php |
||
19 | class RouteHandler |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * @var LoaderInterface |
||
24 | */ |
||
25 | private $loader; |
||
26 | |||
27 | /** |
||
28 | * @var RouteCollection $routes |
||
29 | */ |
||
30 | private $routes; |
||
31 | |||
32 | |||
33 | /** |
||
34 | * RouteHandler constructor. |
||
35 | * |
||
36 | * @param LoaderInterface $loader |
||
37 | * @param RouteCollection $routes |
||
38 | */ |
||
39 | public function __construct(LoaderInterface $loader, RouteCollection $routes) |
||
44 | |||
45 | |||
46 | /** |
||
47 | * @param string $fqcn Fully Qualified Class Name for Route |
||
48 | * @param bool $handle if true [default] will immediately call RouteInterface::handleRequest() |
||
49 | * @throws Exception |
||
50 | * @since $VID:$ |
||
51 | */ |
||
52 | public function addRoute($fqcn, $handle = true) |
||
75 | |||
76 | |||
77 | /** |
||
78 | * finds and returns all Routes that have yet to be handled |
||
79 | * |
||
80 | * @return RouteInterface[] |
||
81 | */ |
||
82 | public function getRoutesForCurrentRequest() |
||
86 | |||
87 | |||
88 | /** |
||
89 | * calls RouteInterface::handleRequest() on all Routes that |
||
90 | * - match current request |
||
91 | * - have yet to be handled |
||
92 | * |
||
93 | * @return void |
||
94 | */ |
||
95 | public function handleRoutesForCurrentRequest() |
||
99 | } |
||
100 |