| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | 2 | protected function run( |
|
| 31 | ServerRequestInterface $request, |
||
| 32 | JsonEnabledResponseInterface $response, |
||
| 33 | array $args |
||
| 34 | ): ResponseInterface { |
||
| 35 | 2 | $playlistId = (int) ($args['playlistId'] ?? 0); |
|
| 36 | |||
| 37 | 2 | $playlist = $this->playlistRepository->find($playlistId); |
|
| 38 | |||
| 39 | 2 | $result = false; |
|
| 40 | |||
| 41 | 2 | if ($playlist !== null) { |
|
| 42 | 1 | $this->validateOwner($request, $playlist); |
|
| 43 | |||
| 44 | 1 | $this->playlistRepository->delete($playlist); |
|
| 45 | |||
| 46 | 1 | $result = true; |
|
| 47 | } |
||
| 48 | |||
| 49 | 2 | return $response->withJson( |
|
| 50 | 2 | [ |
|
| 51 | 2 | 'result' => $result, |
|
| 52 | 2 | ] |
|
| 56 |