| Total Complexity | 5 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | final class AlbumList2Responder implements FormattedResponderInterface |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @param Traversable<array{ |
||
| 15 | * id: string, |
||
| 16 | * name: string, |
||
| 17 | * coverArt: string, |
||
| 18 | * songCount: int, |
||
| 19 | * created: string, |
||
| 20 | * duration: int, |
||
| 21 | * artist: string, |
||
| 22 | * artistId: string, |
||
| 23 | * }> $albumList |
||
| 24 | */ |
||
| 25 | 4 | public function __construct( |
|
| 28 | 4 | } |
|
| 29 | |||
| 30 | 1 | public function writeXml(XMLArray $XMLArray): void |
|
| 31 | { |
||
| 32 | 1 | $XMLArray->startLoop( |
|
| 33 | 1 | 'albumList2', |
|
| 34 | 1 | [], |
|
| 35 | 1 | function (XMLArray $XMLArray): void { |
|
| 36 | 1 | foreach ($this->albumList as $album) { |
|
| 37 | 1 | $XMLArray->add( |
|
| 38 | 1 | 'album', |
|
| 39 | 1 | null, |
|
| 40 | 1 | $album |
|
| 41 | 1 | ); |
|
| 42 | } |
||
| 43 | 1 | } |
|
| 44 | 1 | ); |
|
| 45 | } |
||
| 46 | |||
| 47 | 1 | public function writeJson(array &$root): void |
|
| 48 | { |
||
| 49 | 1 | $root['albumList2'] = ['album' => iterator_to_array($this->albumList)]; |
|
| 50 | } |
||
| 51 | |||
| 52 | 1 | public function isBinaryResponder(): bool |
|
| 55 | } |
||
| 56 | } |
||
| 57 |