GetMusicFoldersMethod::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 7
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Usox\HyperSonic\FeatureSet\V1161\Method;
6
7
use Usox\HyperSonic\Exception\SubSonicApiException;
8
use Usox\HyperSonic\FeatureSet\V1161\Contract\MusicFolderListDataProviderInterface;
9
use Usox\HyperSonic\FeatureSet\V1161\Responder\ResponderFactoryInterface;
10
use Usox\HyperSonic\Response\ResponderInterface;
11
12
/**
13
 * Retrieves the list of available music folders
14
 *
15
 * This class covers the `getMusicFolders.view` method
16
 */
17
final class GetMusicFoldersMethod implements V1161MethodInterface
18
{
19 2
    public function __construct(
20
        private readonly ResponderFactoryInterface $responderFactory,
21
    ) {
22 2
    }
23
24
    /**
25
     * @param array<string, scalar> $queryParams
26
     * @param array<string, scalar> $args
27
     *
28
     * @throws SubSonicApiException
29
     */
30 1
    public function __invoke(
31
        MusicFolderListDataProviderInterface $dataProvider,
32
        array $queryParams,
33
        array $args
34
    ): ResponderInterface {
35 1
        return $this->responderFactory->createMusicFoldersResponder(
36 1
            $dataProvider->getMusicFolders()
37 1
        );
38
    }
39
}
40