| Conditions | 3 |
| Paths | 7 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 53 | public function get($id, $className, callable $findOneCallable, callable $deleteCallable) |
||
| 54 | { |
||
| 55 | try { |
||
| 56 | $data = $findOneCallable(); |
||
| 57 | if (empty($data)) { |
||
| 58 | $mapping = $this->serializer->getTransformer()->getMappingByClassName($className); |
||
| 59 | |||
| 60 | return $this->resourceNotFound(new ErrorBag([new NotFoundError($mapping->getClassAlias(), $id)])); |
||
| 61 | } |
||
| 62 | |||
| 63 | $deleteCallable(); |
||
| 64 | |||
| 65 | return $this->resourceDeleted(); |
||
| 66 | } catch (Exception $e) { |
||
| 67 | return $this->errorResponse(new ErrorBag([new Error('Bad Request', 'Request could not be served.')])); |
||
| 68 | } |
||
| 69 | } |
||
| 70 | } |
||
| 71 |