| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | 2 | protected function run( |
|
| 24 | ServerRequestInterface $request, |
||
| 25 | JsonEnabledResponseInterface $response, |
||
| 26 | array $args |
||
| 27 | ): ResponseInterface { |
||
| 28 | 2 | $artistId = (int) ($args['artistId'] ?? 0); |
|
| 29 | |||
| 30 | 2 | $artist = $this->artistRepository->find($artistId); |
|
| 31 | |||
| 32 | 2 | if ($artist === null) { |
|
| 33 | 1 | return $response->withStatus(Http::NOT_FOUND); |
|
| 34 | } |
||
| 35 | |||
| 36 | 1 | return $response->withJson( |
|
| 37 | 1 | [ |
|
| 38 | 1 | 'id' => $artistId, |
|
| 39 | 1 | 'name' => $artist->getTitle(), |
|
| 40 | 1 | 'cover' => sprintf('%s/art/artist/%d', $this->config->getBaseUrl(), $artistId), |
|
| 41 | 1 | 'mbId' => $artist->getMbid(), |
|
| 42 | 1 | ] |
|
| 46 |