1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace VasilDakov\Speedy\Service\Location\Site; |
6
|
|
|
|
7
|
|
|
use VasilDakov\Speedy\Property; |
8
|
|
|
use VasilDakov\Speedy\Traits\ToArray; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class FindSiteRequest. |
12
|
|
|
* |
13
|
|
|
* @author Vasil Dakov <[email protected]> |
14
|
|
|
* @author Valentin Valkanov <[email protected]> |
15
|
|
|
* @copyright 2009-2022 Neutrino.bg |
16
|
|
|
* |
17
|
|
|
* @version 1.0 |
18
|
|
|
* |
19
|
|
|
* @see https://services.speedy.bg/api/api_examples.html#FindSiteRequest |
20
|
|
|
*/ |
21
|
|
|
class FindSiteRequest |
22
|
|
|
{ |
23
|
|
|
use ToArray; |
|
|
|
|
24
|
|
|
|
25
|
|
|
private int $countryId; |
26
|
|
|
|
27
|
|
|
private ?string $name = null; |
28
|
|
|
|
29
|
|
|
private ?string $postCode = null; |
30
|
|
|
|
31
|
|
|
private ?string $type = null; |
32
|
|
|
|
33
|
|
|
private ?string $municipality = null; |
34
|
5 |
|
|
35
|
|
|
private ?string $region = null; |
36
|
5 |
|
|
37
|
5 |
|
public function __construct(int $countryId, ?string $name = null, ?string $postCode = null) |
38
|
|
|
{ |
39
|
|
|
$this->countryId = $countryId; |
40
|
1 |
|
$this->name = $name; |
41
|
|
|
$this->postCode = $postCode; |
42
|
1 |
|
} |
43
|
|
|
|
44
|
|
|
public function getCountryId(): int |
45
|
|
|
{ |
46
|
|
|
return $this->countryId; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function setCountryId(int $countryId): void |
50
|
1 |
|
{ |
51
|
|
|
$this->countryId = $countryId; |
52
|
1 |
|
} |
53
|
|
|
|
54
|
|
|
public function getName(): ?string |
55
|
|
|
{ |
56
|
|
|
return $this->name; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function setName(?string $name): void |
60
|
1 |
|
{ |
61
|
|
|
$this->name = $name; |
62
|
1 |
|
} |
63
|
|
|
|
64
|
|
|
public function getPostCode(): ?string |
65
|
1 |
|
{ |
66
|
|
|
return $this->postCode; |
67
|
1 |
|
} |
68
|
|
|
|
69
|
|
|
public function setPostCode(?string $postCode): void |
70
|
1 |
|
{ |
71
|
|
|
$this->postCode = $postCode; |
72
|
1 |
|
} |
73
|
|
|
|
74
|
|
|
public function getType(): ?string |
75
|
1 |
|
{ |
76
|
|
|
return $this->type; |
77
|
1 |
|
} |
78
|
|
|
|
79
|
|
|
public function setType(?string $type): void |
80
|
1 |
|
{ |
81
|
|
|
$this->type = $type; |
82
|
1 |
|
} |
83
|
|
|
|
84
|
|
|
public function getMunicipality(): ?string |
85
|
1 |
|
{ |
86
|
|
|
return $this->municipality; |
87
|
1 |
|
} |
88
|
|
|
|
89
|
|
|
public function setMunicipality(?string $municipality): void |
90
|
|
|
{ |
91
|
|
|
$this->municipality = $municipality; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @param string|null $region |
96
|
|
|
*/ |
97
|
|
|
public function setRegion(?string $region): void |
98
|
|
|
{ |
99
|
|
|
$this->region = $region; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return string|null |
104
|
|
|
*/ |
105
|
|
|
public function getRegion(): ?string |
106
|
|
|
{ |
107
|
|
|
return $this->region; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return array<string,string|int|null> |
112
|
|
|
*/ |
113
|
|
|
public function toArray(): array |
114
|
|
|
{ |
115
|
|
|
return [ |
116
|
|
|
Property::COUNTRY_ID->value => $this->countryId, |
117
|
|
|
Property::NAME->value => $this->name, |
118
|
|
|
Property::POST_CODE->value => $this->postCode, |
119
|
|
|
Property::REGION->value => $this->region, |
120
|
|
|
Property::MUNICIPALITY->value => $this->municipality, |
121
|
|
|
]; |
122
|
|
|
} |
123
|
|
|
} |
124
|
|
|
|