1 | <?php |
||
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 |
||
111 | |||
112 | /** |
||
113 | * @return Country|null |
||
114 | */ |
||
115 | public function getCountry(): ?Country |
||
116 | { |
||
119 | |||
120 | /** |
||
121 | * @return Geo|null |
||
122 | */ |
||
123 | public function getGeo(): ?Geo |
||
127 | |||
128 | /** |
||
129 | * @param array $data |
||
130 | * |
||
131 | * @return City |
||
132 | */ |
||
133 | public static function fromApi(array $data): self |
||
155 | } |
||
156 |