| Conditions | 1 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 25 | 1 | public function retrieve( |
|
| 26 | int $limit, |
||
| 27 | ?CatalogInterface $catalog = null, |
||
| 28 | ?GenreInterface $genre = null, |
||
| 29 | ?int $fromYear = null, |
||
| 30 | ?int $toYear = null, |
||
| 31 | ): array { |
||
| 32 | 1 | $list = $this->songRepository->getRandomBy( |
|
| 33 | 1 | $catalog, |
|
| 34 | 1 | $genre, |
|
| 35 | 1 | $fromYear, |
|
| 36 | 1 | $toYear |
|
| 37 | 1 | ); |
|
| 38 | |||
| 39 | // @todo inefficient, but doctrine doesn't support RAND order natively |
||
| 40 | 1 | $list = iterator_to_array($list); |
|
| 41 | |||
| 42 | 1 | shuffle($list); |
|
| 43 | |||
| 44 | 1 | return array_slice($list, 0, $limit); |
|
| 45 | } |
||
| 47 |