Total Complexity | 5 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | final class ArtistResponder implements FormattedResponderInterface |
||
11 | { |
||
12 | /** |
||
13 | * @param array{ |
||
14 | * id: string, |
||
15 | * name: string, |
||
16 | * coverArt: string, |
||
17 | * albumCount: int, |
||
18 | * artistImageUrl: string, |
||
19 | * } $artist |
||
20 | * @param array<array{ |
||
21 | * id: string, |
||
22 | * name: string, |
||
23 | * coverArt: string, |
||
24 | * songCount: int, |
||
25 | * created: string, |
||
26 | * duration: int, |
||
27 | * artist: string, |
||
28 | * artistId: string, |
||
29 | * year: string, |
||
30 | * genre: string, |
||
31 | * playCount: int |
||
32 | * }> $albums |
||
33 | */ |
||
34 | 4 | public function __construct( |
|
38 | 4 | } |
|
39 | |||
40 | 1 | public function writeXml(XMLArray $XMLArray): void |
|
41 | { |
||
42 | 1 | $artistNode = $XMLArray->start( |
|
43 | 1 | 'artist', |
|
44 | 1 | $this->artist, |
|
45 | 1 | ); |
|
46 | |||
47 | 1 | foreach ($this->albums as $album) { |
|
48 | 1 | $artistNode->add( |
|
49 | 1 | 'album', |
|
50 | 1 | null, |
|
51 | 1 | $album |
|
52 | 1 | ); |
|
53 | } |
||
54 | |||
55 | 1 | $artistNode->end(); |
|
56 | } |
||
57 | |||
58 | 1 | public function writeJson(array &$root): void |
|
62 | } |
||
63 | |||
64 | 1 | public function isBinaryResponder(): bool |
|
67 | } |
||
68 | } |
||
69 |