| Conditions | 3 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | 12 | public function getTransformer($resource): CanTransform |
|
| 43 | { |
||
| 44 | 12 | $className = get_class($resource); |
|
| 45 | |||
| 46 | do { |
||
| 47 | 12 | if (isset($this->transformerByResourceClass[$className])) { |
|
| 48 | 11 | return $this->transformerByResourceClass[$className]; |
|
| 49 | } |
||
| 50 | 3 | } while ($className = get_parent_class($className)); |
|
| 51 | |||
| 52 | 1 | throw new TransformerNotFoundException( |
|
| 53 | 1 | sprintf('Transformer for resource "%s" is missing', get_class($resource)) |
|
| 54 | ); |
||
| 57 |