| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2.0116 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | 19 | public function resolve(EntityInterface $entity) |
|
| 24 | { |
||
| 25 | 19 | $nameEntity = get_class($entity); |
|
| 26 | 19 | $nameEntityShort = substr($nameEntity, strrpos($nameEntity, 'Entity') + 6); |
|
| 27 | |||
| 28 | 19 | $serialiserName = sprintf('Graze\\UnicontrollerClient\\Serialiser\\Serialiser\\Serialiser%s', $nameEntityShort); |
|
| 29 | 19 | if (!class_exists($serialiserName)) { |
|
| 30 | throw new \OutOfBoundsException(sprintf('no serialiser defined for entity [%s]', $nameEntity)); |
||
| 31 | } |
||
| 32 | |||
| 33 | 19 | return $serialiserName::factory(); |
|
| 34 | } |
||
| 36 |