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.
Completed
Push — master ( 2d6776...74b698 )
by Christian
01:44
created

City::getCountry()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 City
15
{
16
    /**
17
     * @var int
18
     */
19
    private $id;
20
21
    /**
22
     * @var string
23
     */
24
    private $name;
25
26
    /**
27
     * @var string|null
28
     */
29
    private $state;
30
31
    /**
32
     * @var string|null
33
     */
34
    private $stateCode;
35
36
    /**
37
     * @var Country|null
38
     */
39
    private $country;
40
41
    /**
42
     * @var Geo|null
43
     */
44
    private $geo;
45
46
    /**
47
     * @param int          $id
48
     * @param string       $name
49
     * @param string|null  $state
50
     * @param string|null  $stateCode
51
     * @param Country|null $county
52
     * @param Geo|null     $geo
53
     */
54
    public function __construct(
55
        int $id,
56
        string $name,
57
        ?string $state,
58
        ?string $stateCode,
59
        ?Country $county,
60
        ?Geo $geo
61
    ) {
62
        $this->id        = $id;
63
        $this->name      = $name;
64
        $this->state     = $state;
65
        $this->stateCode = $stateCode;
66
        $this->country   = $county;
67
        $this->geo       = $geo;
68
    }
69
70
    /**
71
     * @return int
72
     */
73
    public function getId(): int
74
    {
75
        return $this->id;
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function getName(): string
82
    {
83
        return $this->name;
84
    }
85
86
    /**
87
     * @return string|null
88
     */
89
    public function getState(): ?string
90
    {
91
        return $this->state;
92
    }
93
94
    /**
95
     * @return string|null
96
     */
97
    public function getStateCode(): ?string
98
    {
99
        return $this->stateCode;
100
    }
101
102
    /**
103
     * @deprecated use getCountry instead
104
     *
105
     * @return Country|null
106
     */
107
    public function getCounty(): ?Country
108
    {
109
        return $this->getCountry();
110
    }
111
112
    /**
113
     * @return Country|null
114
     */
115
    public function getCountry(): ?Country
116
    {
117
        return $this->country;
118
    }
119
120
    /**
121
     * @return Geo|null
122
     */
123
    public function getGeo(): ?Geo
124
    {
125
        return $this->geo;
126
    }
127
128
    /**
129
     * @param array $data
130
     *
131
     * @return City
132
     */
133
    public static function fromApi(array $data): self
134
    {
135
        $geo     = null;
136
        $country = null;
137
138
        if ($data['coords']) {
139
            $geo = Geo::fromApi($data['coords']);
140
        }
141
142
        if ($data['country']) {
143
            $country = Country::fromApi($data['country']);
144
        }
145
146
        return new self(
147
            (int) $data['id'],
148
            $data['name'],
149
            $data['state'],
150
            $data['stateCode'],
151
            $country,
152
            $geo
153
        );
154
    }
155
}
156