Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
9 | function dispatcher(callable $callback, array $options = []) |
||
10 | { |
||
11 | $options += [ |
||
12 | 'routeParser' => RouteParser::class, |
||
13 | 'routeGenerator' => RouteGenerator::class, |
||
14 | 'dispatcher' => RouteDispatcher::class, |
||
15 | 'routeCollector' => RouteCollector::class, |
||
16 | ]; |
||
17 | |||
18 | $routeCollector = new $options['routeCollector']( |
||
19 | new $options['routeParser'], new $options['routeGenerator'] |
||
20 | ); |
||
21 | $callback($routeCollector); |
||
22 | |||
23 | return new $options['dispatcher']($routeCollector); |
||
24 | } |
||
25 | } |
||
26 |