GetCoverArtMethod   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 23
ccs 9
cts 9
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 12 1
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