| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 44 | public function transform($itemId) |
||
| 45 | { |
||
| 46 | if (!$itemId) { |
||
| 47 | return null; |
||
| 48 | } |
||
| 49 | |||
| 50 | try { |
||
| 51 | $item = $this->itemRepository->getItem(Uuid::fromString($itemId)); |
||
| 52 | } catch (ItemNotFoundException $e) { |
||
| 53 | throw new TransformationFailedException(sprintf('Item "%s" not found !', $itemId)); |
||
| 54 | } catch (InvalidUuidStringException $e) { |
||
| 55 | throw new TransformationFailedException(sprintf('Invalid UUID "%s" !', $itemId)); |
||
| 56 | } |
||
| 57 | |||
| 58 | return $item; |
||
| 59 | } |
||
| 60 | } |