Passed
Push — main ( a2d9fb...be9758 )
by Daniel
02:34
created

ResponderFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 9
dl 0
loc 53
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createLicenseResponder() 0 5 1
A createCoverArtResponder() 0 7 1
A createPingResponder() 0 3 1
A createArtistsResponder() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Usox\HyperSonic\FeatureSet\V1161\Responder;
6
7
use Usox\HyperSonic\Response\ResponderInterface;
8
9
final class ResponderFactory implements ResponderFactoryInterface
10
{
11
    /**
12
     * @param array{
13
     *  ignoredArticles: string,
14
     *  index: array<array{
15
     *    name: string,
16
     *    artist: array<array{
17
     *      id: string,
18
     *      name: string,
19
     *      coverArt: string,
20
     *      artistImageUrl: string,
21
     *      albumCount: int,
22
     *      starred?: string
23
     *    }>
24
     *  }>
25
     * } $artistList
26
     */
27 1
    public function createArtistsResponder(
28
        array $artistList
29
    ): ResponderInterface {
30 1
        return new ArtistsResponder(
31
            $artistList,
32
        );
33
    }
34
35
    /**
36
     * @param array{
37
     *  valid: string,
38
     *  email: string,
39
     *  licenseExpires: string
40
     * } $licenseData
41
     */
42 1
    public function createLicenseResponder(
43
        array $licenseData
44
    ): ResponderInterface {
45 1
        return new LicenseResponder(
46
            $licenseData,
47
        );
48
    }
49
50 1
    public function createPingResponder(): ResponderInterface
51
    {
52 1
        return new PingResponder();
53
    }
54
55 1
    public function createCoverArtResponder(
56
        string $coverArt,
57
        string $contentType,
58
    ): ResponderInterface {
59 1
        return new CoverArtResponder(
60
            $coverArt,
61
            $contentType,
62
        );
63
    }
64
}
65