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 |
||
25 | 4 | public function get($name) |
|
26 | { |
||
27 | 4 | $handler = $this->getHandler($name); |
|
28 | 4 | if (!$handler) { |
|
29 | 1 | throw HandlerException::notFound($name); |
|
30 | } |
||
31 | |||
32 | 3 | if (is_string($handler) && class_exists($handler)) { |
|
33 | 1 | $handler = new $handler; |
|
34 | 1 | } |
|
35 | |||
36 | 3 | if (is_callable($handler)) { |
|
37 | 2 | return $handler; |
|
38 | } |
||
39 | |||
40 | 1 | throw HandlerException::invalidHandler($name); |
|
41 | } |
||
42 | |||
55 |