| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 1 | protected function run( |
|
| 26 | ServerRequestInterface $request, |
||
| 27 | JsonEnabledResponseInterface $response, |
||
| 28 | array $args |
||
| 29 | ): ResponseInterface { |
||
| 30 | 1 | $list = []; |
|
| 31 | |||
| 32 | 1 | $limit = (int) ($args['limit'] ?? self::DEFAULT_LIMIT); |
|
| 33 | |||
| 34 | 1 | foreach ($this->randomSongsRetriever->retrieve($limit) as $song) { |
|
| 35 | 1 | $album = $song->getDisc()->getAlbum(); |
|
| 36 | |||
| 37 | 1 | $list[] = $this->resultItemFactory->createSongListItem($song, $album); |
|
| 38 | } |
||
| 39 | |||
| 40 | 1 | return $response->withJson( |
|
| 41 | 1 | ['items' => $list] |
|
| 42 | 1 | ); |
|
| 45 |