GetCoverArtMethod::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 1
cts 1
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\FeatureSet\V1161\Contract\GetCoverArtDataProviderInterface;
8
use Usox\HyperSonic\FeatureSet\V1161\Responder\ResponderFactoryInterface;
9
use Usox\HyperSonic\Response\ResponderInterface;
10
11
/**
12
 * Retrieves and transforms data regarding artists- and album covers
13
 *
14
 * This class covers the `getCoverArt.view` method
15
 */
16
final class GetCoverArtMethod implements V1161MethodInterface
17
{
18 2
    public function __construct(
19
        private readonly ResponderFactoryInterface $responderFactory,
20
    ) {
21 2
    }
22
23
    /**
24
     * @param array<string, scalar> $queryParams
25
     * @param array<string, scalar> $args
26
     */
27 1
    public function __invoke(
28
        GetCoverArtDataProviderInterface $getCoverArtDataProvider,
29
        array $queryParams,
30
        array $args
31
    ): ResponderInterface {
32 1
        $art = $getCoverArtDataProvider->getArt(
33 1
            (string) ($queryParams['id'] ?? '')
34 1
        );
35
36 1
        return $this->responderFactory->createCoverArtResponder(
37 1
            $art['art'],
38 1
            $art['contentType'],
39 1
        );
40
    }
41
}
42