| Total Complexity | 4 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | final class ArtistListDataProvider implements ArtistListDataProviderInterface |
||
| 16 | { |
||
| 17 | 2 | public function __construct( |
|
| 18 | private readonly ArtistRepositoryInterface $artistRepository |
||
|
|
|||
| 19 | ) { |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @return array<string> |
||
| 24 | * |
||
| 25 | * @todo implement stripping of articles (like 'the, el, los, ...') |
||
| 26 | */ |
||
| 27 | 1 | public function getIgnoredArticles(): array |
|
| 28 | { |
||
| 29 | 1 | return []; |
|
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return Generator<array{ |
||
| 34 | * id: string, |
||
| 35 | * name: string, |
||
| 36 | * coverArtId: string, |
||
| 37 | * artistImageUrl: string, |
||
| 38 | * albumCount: int, |
||
| 39 | * starred: null|DateTimeInterface |
||
| 40 | * }> |
||
| 41 | */ |
||
| 42 | 1 | public function getArtists( |
|
| 43 | ?string $musicFolderId |
||
| 44 | ): Generator { |
||
| 45 | 1 | foreach ($this->artistRepository->findBy([], ['title' => 'ASC']) as $artist) { |
|
| 46 | 1 | $artistId = $artist->getId(); |
|
| 47 | |||
| 48 | yield [ |
||
| 49 | 1 | 'id' => (string) $artistId, |
|
| 50 | 1 | 'name' => (string) $artist->getTitle(), |
|
| 51 | 'artistImageUrl' => '', |
||
| 52 | 1 | 'coverArtId' => 'artist-'.$artistId, |
|
| 53 | 1 | 'albumCount' => $artist->getAlbumCount(), |
|
| 54 | 'starred' => null, |
||
| 55 | ]; |
||
| 59 |