GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Song   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 10
lcom 0
cbo 1
dl 0
loc 87
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getName() 0 4 1
A getInfo() 0 4 1
A getCover() 0 4 1
A isTaped() 0 4 1
A getFeaturings() 0 4 1
A fromApi() 0 16 4
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\SetlistFm\Model;
13
14
final class Song
15
{
16
    /**
17
     * @var string
18
     */
19
    private $name;
20
21
    /**
22
     * @var string|null
23
     */
24
    private $info;
25
26
    /**
27
     * @var Artist|null
28
     */
29
    private $cover;
30
31
    /**
32
     * @var bool
33
     */
34
    private $taped;
35
36
    /**
37
     * @var Artist[]
38
     */
39
    private $featurings;
40
41
    /**
42
     * @param Artist[] $featurings
43
     */
44
    public function __construct(string $name, ?string $info, ?Artist $cover, bool $taped, array $featurings)
45
    {
46
        $this->name       = $name;
47
        $this->info       = $info;
48
        $this->cover      = $cover;
49
        $this->taped      = $taped;
50
        $this->featurings = $featurings;
51
    }
52
53
    public function getName(): string
54
    {
55
        return $this->name;
56
    }
57
58
    public function getInfo(): ?string
59
    {
60
        return $this->info;
61
    }
62
63
    public function getCover(): ?Artist
64
    {
65
        return $this->cover;
66
    }
67
68
    public function isTaped(): bool
69
    {
70
        return $this->taped;
71
    }
72
73
    /**
74
     * @return Artist[]
75
     */
76
    public function getFeaturings(): array
77
    {
78
        return $this->featurings;
79
    }
80
81
    /**
82
     * @return Song
83
     */
84
    public static function fromApi(array $data): self
85
    {
86
        $featuring = [];
87
88
        if (\array_key_exists('with', $data)) {
89
            $featuring[] = Artist::fromApi($data['with']);
90
        }
91
92
        return new self(
93
            $data['name'],
94
            $data['info'] ?? null,
95
            isset($data['cover']) ? Artist::fromApi($data['cover']) : null,
96
            isset($data['tape']) ? (bool) $data['tape'] : false,
97
            $featuring
98
        );
99
    }
100
}
101