Passed
Push — main ( 157393...6183ca )
by Daniel
02:06
created

ResponderFactory::createArtistResponder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Usox\HyperSonic\FeatureSet\V1161\Responder;
6
7
use DateTimeInterface;
8
use Usox\HyperSonic\Response\ResponderInterface;
9
10
final class ResponderFactory implements ResponderFactoryInterface
11
{
12
    /**
13
     * @param array{
14
     *  ignoredArticles: string,
15
     *  index: array<array{
16
     *    name: string,
17
     *    artist: array<array{
18
     *      id: string,
19
     *      name: string,
20
     *      coverArt: string,
21
     *      artistImageUrl: string,
22
     *      albumCount: int,
23
     *      starred?: string
24
     *    }>
25
     *  }>
26
     * } $artistList
27
     */
28 1
    public function createArtistsResponder(
29
        array $artistList
30
    ): ResponderInterface {
31 1
        return new ArtistsResponder(
32
            $artistList,
33
        );
34
    }
35
36
    /**
37
     * @param array{
38
     *  valid: string,
39
     *  email: string,
40
     *  licenseExpires: string
41
     * } $licenseData
42
     */
43 1
    public function createLicenseResponder(
44
        array $licenseData
45
    ): ResponderInterface {
46 1
        return new LicenseResponder(
47
            $licenseData,
48
        );
49
    }
50
51 1
    public function createPingResponder(): ResponderInterface
52
    {
53 1
        return new PingResponder();
54
    }
55
56 1
    public function createCoverArtResponder(
57
        string $coverArt,
58
        string $contentType,
59
    ): ResponderInterface {
60 1
        return new CoverArtResponder(
61
            $coverArt,
62
            $contentType,
63
        );
64
    }
65
66
    /**
67
     * @param array{
68
     *  id: string,
69
     *  name: string,
70
     *  coverArt: string,
71
     *  albumCount: int,
72
     *  artistImageUrl: string,
73
     * } $artist
74
     * @param array<array{
75
     *  id: string,
76
     *  name: string,
77
     *  coverArt: string,
78
     *  songCount: int,
79
     *  created: string,
80
     *  duration: int,
81
     *  artist: string,
82
     *  artistId: string,
83
     *  year: string,
84
     *  genre: string,
85
     *  playCount: int
86
     * }> $albums
87
     */
88 1
    public function createArtistResponder(
89
        array $artist,
90
        array $albums,
91
    ): ResponderInterface {
92 1
        return new ArtistResponder($artist, $albums);
93
    }
94
}
95