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