| Conditions | 5 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 26 | 4 | public function get($handler) |
|
| 27 | { |
||
| 28 | 4 | $route = $this->getRoute($handler); |
|
| 29 | 4 | if (!$route) { |
|
| 30 | 1 | throw RouterException::routeNotFound($handler); |
|
| 31 | } |
||
| 32 | |||
| 33 | 3 | if (is_string($route) && class_exists($route)) { |
|
| 34 | 1 | $route = new $route; |
|
| 35 | 1 | } |
|
| 36 | |||
| 37 | 3 | if (is_callable($route)) { |
|
| 38 | 2 | return $route; |
|
| 39 | } |
||
| 40 | |||
| 41 | 1 | throw HandlerException::invalidHandler($handler); |
|
| 42 | } |
||
| 43 | |||
| 56 |