| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | 79 | public static function configure(Closure $fn): void |
|
| 20 | { |
||
| 21 | 79 | $routes = new Routes(); |
|
| 22 | 79 | $bindings = new Bindings(); |
|
| 23 | 79 | $handlers = new Handlers(); |
|
| 24 | |||
| 25 | 79 | $params = array_map(static fn ($param) => match ((string)$param->getType()) { |
|
| 26 | 79 | Routes::class => $routes, |
|
| 27 | 79 | Bindings::class => $bindings, |
|
| 28 | 79 | Handlers::class => $handlers, |
|
| 29 | 79 | default => null, |
|
| 30 | 79 | }, (new ReflectionFunction($fn))->getParameters()); |
|
| 31 | |||
| 32 | 79 | $fn(...$params); |
|
| 33 | |||
| 34 | try { |
||
| 35 | 78 | echo self::findRoute($routes)->run($bindings); |
|
| 36 | 2 | } catch (Exception $exception) { |
|
| 37 | 2 | echo self::handleException($handlers, $exception); |
|
| 38 | } |
||
| 63 |