| Total Complexity | 5 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class GenresResponder implements FormattedResponderInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @param array<array{ |
||
| 14 | * value: string, |
||
| 15 | * albumCount: int, |
||
| 16 | * songCount: int |
||
| 17 | * }> $genres |
||
| 18 | */ |
||
| 19 | 4 | public function __construct( |
|
| 20 | private readonly array $genres |
||
| 21 | ) { |
||
| 22 | 4 | } |
|
| 23 | |||
| 24 | 1 | public function writeXml(XMLArray $XMLArray): void |
|
| 25 | { |
||
| 26 | 1 | $XMLArray->startLoop( |
|
| 27 | 1 | 'genres', |
|
| 28 | 1 | [], |
|
| 29 | 1 | function (XMLArray $XMLArray): void { |
|
| 30 | 1 | foreach ($this->genres as $genre) { |
|
| 31 | 1 | $XMLArray->add( |
|
| 32 | 1 | 'genre', |
|
| 33 | 1 | htmlspecialchars($genre['value']), |
|
| 34 | 1 | [ |
|
| 35 | 1 | 'albumCount' => $genre['albumCount'], |
|
| 36 | 1 | 'songCount' => $genre['songCount'], |
|
| 37 | 1 | ], |
|
| 38 | 1 | ); |
|
| 39 | } |
||
| 40 | 1 | } |
|
| 41 | 1 | ); |
|
| 42 | } |
||
| 43 | |||
| 44 | 1 | public function writeJson(array &$root): void |
|
| 47 | } |
||
| 48 | |||
| 49 | 1 | public function isBinaryResponder(): bool |
|
| 52 | } |
||
| 53 | } |
||
| 54 |