1 | <?php |
||
2 | |||
3 | namespace NStack\Models; |
||
4 | |||
5 | /** |
||
6 | * Class Country |
||
7 | * |
||
8 | * @package NStack\Models |
||
9 | * @author Casper Rasmussen <[email protected]> |
||
10 | */ |
||
11 | class Country extends Model |
||
12 | { |
||
13 | /** @var int */ |
||
14 | protected $id; |
||
15 | |||
16 | /** @var string */ |
||
17 | protected $code; |
||
18 | |||
19 | /** @var string */ |
||
20 | protected $codeIso; |
||
21 | |||
22 | /** @var string */ |
||
23 | protected $name; |
||
24 | |||
25 | /** @var string */ |
||
26 | protected $native; |
||
27 | |||
28 | /** @var int */ |
||
29 | protected $phone; |
||
30 | |||
31 | /** @var string */ |
||
32 | protected $continent; |
||
33 | |||
34 | /** @var ?string */ |
||
35 | protected $capital; |
||
36 | |||
37 | /** @var ?double */ |
||
38 | protected $capitalLat; |
||
39 | |||
40 | /** @var ?double */ |
||
41 | protected $capitalLng; |
||
42 | |||
43 | /** @var string */ |
||
44 | protected $currency; |
||
45 | |||
46 | /** @var string */ |
||
47 | protected $currencyName; |
||
48 | |||
49 | /** @var array */ |
||
50 | protected $languages; |
||
51 | |||
52 | /** @var string */ |
||
53 | protected $image1Url; |
||
54 | |||
55 | /** @var string */ |
||
56 | protected $image2Url; |
||
57 | |||
58 | /** @var string */ |
||
59 | protected $imageUrl; |
||
60 | |||
61 | /** @var ?\NStack\Models\Timezone */ |
||
62 | protected $capitalTimezone; |
||
63 | |||
64 | /** |
||
65 | * parse |
||
66 | * |
||
67 | * @param array $data |
||
68 | * @throws \NStack\Exceptions\FailedToParseException |
||
69 | * @author Casper Rasmussen <[email protected]> |
||
70 | */ |
||
71 | 2 | public function parse(array $data) |
|
72 | { |
||
73 | 2 | $this->id = (int)$data['id']; |
|
74 | 2 | $this->code = (string)$data['code']; |
|
75 | 2 | $this->codeIso = (string)$data['code_iso']; |
|
76 | 2 | $this->name = (string)$data['name']; |
|
77 | 2 | $this->native = (string)$data['native']; |
|
78 | 2 | $this->phone = (int)$data['phone']; |
|
79 | 2 | $this->capital = !empty($data['capital']) ? (string)$data['capital'] : null; |
|
80 | 2 | $this->capitalLat = !empty($data['capital_lat']) ? (double)$data['capital_lat'] : null; |
|
81 | 2 | $this->capitalLng = !empty($data['capital_lng']) ? (double)$data['capital_lng'] : null; |
|
82 | 2 | $this->currency = (string)$data['currency']; |
|
83 | 2 | $this->currencyName = (string)$data['currency_name']; |
|
84 | 2 | $this->languages = explode(',', $data['languages']); |
|
85 | 2 | $this->image1Url = (string)$data['image_1_url']; |
|
86 | 2 | $this->image2Url = (string)$data['image_2_url']; |
|
87 | 2 | $this->capitalTimezone = $data['capital_timezone'] ? new Timezone($data['capital_timezone']) : null; |
|
88 | 2 | } |
|
89 | |||
90 | /** |
||
91 | * toArray |
||
92 | * |
||
93 | * @return array |
||
94 | * @author Casper Rasmussen <[email protected]> |
||
95 | */ |
||
96 | public function toArray(): array |
||
97 | { |
||
98 | return [ |
||
99 | 'id' => $this->id, |
||
100 | 'code' => $this->code, |
||
101 | 'code_iso' => $this->codeIso, |
||
102 | 'name' => $this->name, |
||
103 | 'native' => $this->native, |
||
104 | 'phone' => $this->phone, |
||
105 | 'capital' => $this->capital, |
||
106 | 'capital_lat' => $this->capitalLat, |
||
107 | 'capital_lng' => $this->capitalLng, |
||
108 | 'currency' => $this->currency, |
||
109 | 'currencyName' => $this->currencyName, |
||
110 | 'languages' => $this->languages, |
||
111 | 'image_1_url' => $this->image1Url, |
||
112 | 'image_2_url' => $this->image2Url, |
||
113 | 'capital_time_zone' => $this->capitalTimezone->toArray(), |
||
0 ignored issues
–
show
|
|||
114 | ]; |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * @return int |
||
119 | * @author Casper Rasmussen <[email protected]> |
||
120 | */ |
||
121 | public function getId(): int |
||
122 | { |
||
123 | return $this->id; |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * @return string |
||
128 | * @author Casper Rasmussen <[email protected]> |
||
129 | */ |
||
130 | public function getCode(): string |
||
131 | { |
||
132 | return $this->code; |
||
133 | } |
||
134 | |||
135 | /** |
||
136 | * @return string |
||
137 | * @author Casper Rasmussen <[email protected]> |
||
138 | */ |
||
139 | public function getCodeIso(): string |
||
140 | { |
||
141 | return $this->codeIso; |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * @return string |
||
146 | * @author Casper Rasmussen <[email protected]> |
||
147 | */ |
||
148 | public function getName(): string |
||
149 | { |
||
150 | return $this->name; |
||
151 | } |
||
152 | |||
153 | /** |
||
154 | * @return string |
||
155 | * @author Casper Rasmussen <[email protected]> |
||
156 | */ |
||
157 | public function getNative(): string |
||
158 | { |
||
159 | return $this->native; |
||
160 | } |
||
161 | |||
162 | /** |
||
163 | * @return int |
||
164 | * @author Casper Rasmussen <[email protected]> |
||
165 | */ |
||
166 | public function getPhone(): int |
||
167 | { |
||
168 | return $this->phone; |
||
169 | } |
||
170 | |||
171 | /** |
||
172 | * @return string |
||
173 | * @author Casper Rasmussen <[email protected]> |
||
174 | */ |
||
175 | public function getContinent(): string |
||
176 | { |
||
177 | return $this->continent; |
||
178 | } |
||
179 | |||
180 | /** |
||
181 | * @return mixed |
||
182 | * @author Casper Rasmussen <[email protected]> |
||
183 | */ |
||
184 | public function getCapital() |
||
185 | { |
||
186 | return $this->capital; |
||
187 | } |
||
188 | |||
189 | /** |
||
190 | * @return mixed |
||
191 | * @author Casper Rasmussen <[email protected]> |
||
192 | */ |
||
193 | public function getCapitalLat() |
||
194 | { |
||
195 | return $this->capitalLat; |
||
196 | } |
||
197 | |||
198 | /** |
||
199 | * @return mixed |
||
200 | * @author Casper Rasmussen <[email protected]> |
||
201 | */ |
||
202 | public function getCapitalLng() |
||
203 | { |
||
204 | return $this->capitalLng; |
||
205 | } |
||
206 | |||
207 | /** |
||
208 | * @return string |
||
209 | * @author Casper Rasmussen <[email protected]> |
||
210 | */ |
||
211 | public function getCurrency(): string |
||
212 | { |
||
213 | return $this->currency; |
||
214 | } |
||
215 | |||
216 | /** |
||
217 | * @return string |
||
218 | * @author Casper Rasmussen <[email protected]> |
||
219 | */ |
||
220 | public function getCurrencyName(): string |
||
221 | { |
||
222 | return $this->currencyName; |
||
223 | } |
||
224 | |||
225 | /** |
||
226 | * @return array |
||
227 | * @author Casper Rasmussen <[email protected]> |
||
228 | */ |
||
229 | public function getLanguages(): array |
||
230 | { |
||
231 | return $this->languages; |
||
232 | } |
||
233 | |||
234 | /** |
||
235 | * @return string |
||
236 | * @author Casper Rasmussen <[email protected]> |
||
237 | */ |
||
238 | public function getImage1Url(): string |
||
239 | { |
||
240 | return $this->image1Url; |
||
241 | } |
||
242 | |||
243 | /** |
||
244 | * @return string |
||
245 | * @author Casper Rasmussen <[email protected]> |
||
246 | */ |
||
247 | public function getImage2Url(): string |
||
248 | { |
||
249 | return $this->image2Url; |
||
250 | } |
||
251 | |||
252 | /** |
||
253 | * @return string |
||
254 | * @author Casper Rasmussen <[email protected]> |
||
255 | */ |
||
256 | public function getImageUrl(): string |
||
257 | { |
||
258 | return $this->imageUrl; |
||
259 | } |
||
260 | |||
261 | /** |
||
262 | * getCapitalTimezone |
||
263 | * |
||
264 | * @return \NStack\Models\Timezone|null |
||
265 | * @author Casper Rasmussen <[email protected]> |
||
266 | */ |
||
267 | public function getCapitalTimezone(): ?\NStack\Models\Timezone |
||
268 | { |
||
269 | return $this->capitalTimezone; |
||
270 | } |
||
271 | } |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.