| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 29 | 2 | protected function run( |
|
| 30 | ServerRequestInterface $request, |
||
| 31 | ResponseInterface $response, |
||
| 32 | array $args |
||
| 33 | ): ResponseInterface { |
||
| 34 | 2 | $obj = $this->getItem($request, $args); |
|
| 35 | |||
| 36 | 2 | if ($obj === null) { |
|
| 37 | 1 | return $response->withStatus(StatusCode::NOT_FOUND); |
|
| 38 | } |
||
| 39 | |||
| 40 | /** @var UserInterface $user */ |
||
| 41 | 1 | $user = $request->getAttribute(SessionValidatorMiddleware::USER); |
|
| 42 | |||
| 43 | 1 | return $this->asJson( |
|
| 44 | 1 | $response, |
|
| 45 | [ |
||
| 46 | 1 | 'result' => $this->favoriteManager->remove($obj, $user->getId()) |
|
| 47 | ] |
||
| 51 |