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.

User   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 93
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A getName() 0 4 1
A getCountry() 0 4 1
A getAge() 0 4 1
A getGender() 0 4 1
A getPlaycount() 0 4 1
A getUrl() 0 4 1
A fromApi() 0 11 3
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\LastFm\Model;
13
14
final class User
15
{
16
    /**
17
     * @var string
18
     */
19
    private $name;
20
21
    /**
22
     * @var string|null
23
     */
24
    private $country;
25
26
    /**
27
     * @var int|null
28
     */
29
    private $age;
30
31
    /**
32
     * @var string|null
33
     */
34
    private $gender;
35
36
    /**
37
     * @var int
38
     */
39
    private $playcount;
40
41
    /**
42
     * @var string|null
43
     */
44
    private $url;
45
46
    public function __construct(
47
        string $name,
48
        ?string $country,
49
        ?int $age,
50
        ?string $gender,
51
        int $playcount,
52
        ?string $url
53
    ) {
54
        $this->name      = $name;
55
        $this->country   = $country;
56
        $this->age       = $age;
57
        $this->gender    = $gender;
58
        $this->playcount = $playcount;
59
        $this->url       = $url;
60
    }
61
62
    public function getName(): string
63
    {
64
        return $this->name;
65
    }
66
67
    public function getCountry(): ?string
68
    {
69
        return $this->country;
70
    }
71
72
    public function getAge(): ?int
73
    {
74
        return $this->age;
75
    }
76
77
    public function getGender(): ?string
78
    {
79
        return $this->gender;
80
    }
81
82
    public function getPlaycount(): int
83
    {
84
        return $this->playcount;
85
    }
86
87
    public function getUrl(): ?string
88
    {
89
        return $this->url;
90
    }
91
92
    /**
93
     * @return User
94
     */
95
    public static function fromApi(array $data): self
96
    {
97
        return new self(
98
            $data['name'],
99
            $data['country'] ?? null,
100
            $data['age'] ? (int) $data['age'] : null,
101
            $data['gender'] ?? null,
102
            $data['playcount'] ? (int) $data['playcount'] : 0,
103
            $data['url'] ?? null
104
        );
105
    }
106
}
107