| Conditions | 3 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.1406 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | 1 | public function getType($type_name) |
|
| 28 | { |
||
| 29 | 1 | if (! $this->has($type_name)) { |
|
| 30 | 1 | $this->register($type_name); // auto-wiring (for Types with no special constructor dependencies) |
|
| 31 | } |
||
| 32 | |||
| 33 | 1 | $type = $this->get($type_name); |
|
| 34 | |||
| 35 | 1 | if (! $type instanceof Type) { |
|
| 36 | $class_name = get_class($type); |
||
| 37 | |||
| 38 | throw new UnexpectedValueException("{$class_name} does not implement the Type interface"); |
||
| 39 | } |
||
| 40 | |||
| 41 | 1 | return $type; |
|
| 42 | } |
||
| 43 | |||
| 60 |