| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | 1 | protected function run( |
|
| 23 | ServerRequestInterface $request, |
||
| 24 | JsonEnabledResponseInterface $response, |
||
| 25 | array $args |
||
| 26 | ): ResponseInterface { |
||
| 27 | 1 | $list = []; |
|
| 28 | |||
| 29 | 1 | $artistId = (int) ($args['artistId'] ?? 0); |
|
| 30 | |||
| 31 | 1 | $result = $this->albumRepository->findBy(['artist_id' => $artistId], ['title' => 'ASC']); |
|
| 32 | |||
| 33 | 1 | foreach ($result as $album) { |
|
| 34 | 1 | foreach ($album->getDiscs() as $disc) { |
|
| 35 | 1 | foreach ($disc->getSongs() as $song) { |
|
| 36 | 1 | $list[] = $this->resultItemFactory->createSongListItem($song, $album); |
|
| 37 | } |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | 1 | return $response->withJson(['items' => $list]); |
|
| 42 | } |
||
| 44 |