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
|
|
|
public function __construct(int $countryId, ?string $name = null, ?string $postCode = null) |
36
|
5 |
|
{ |
37
|
5 |
|
$this->countryId = $countryId; |
38
|
|
|
$this->name = $name; |
39
|
|
|
$this->postCode = $postCode; |
40
|
1 |
|
} |
41
|
|
|
|
42
|
1 |
|
public function getCountryId(): int |
43
|
|
|
{ |
44
|
|
|
return $this->countryId; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function setCountryId(int $countryId): void |
48
|
|
|
{ |
49
|
|
|
$this->countryId = $countryId; |
50
|
1 |
|
} |
51
|
|
|
|
52
|
1 |
|
public function getName(): ?string |
53
|
|
|
{ |
54
|
|
|
return $this->name; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function setName(?string $name): void |
58
|
|
|
{ |
59
|
|
|
$this->name = $name; |
60
|
1 |
|
} |
61
|
|
|
|
62
|
1 |
|
public function getPostCode(): ?string |
63
|
|
|
{ |
64
|
|
|
return $this->postCode; |
65
|
1 |
|
} |
66
|
|
|
|
67
|
1 |
|
public function setPostCode(?string $postCode): void |
68
|
|
|
{ |
69
|
|
|
$this->postCode = $postCode; |
70
|
1 |
|
} |
71
|
|
|
|
72
|
1 |
|
public function getType(): ?string |
73
|
|
|
{ |
74
|
|
|
return $this->type; |
75
|
1 |
|
} |
76
|
|
|
|
77
|
1 |
|
public function setType(?string $type): void |
78
|
|
|
{ |
79
|
|
|
$this->type = $type; |
80
|
1 |
|
} |
81
|
|
|
|
82
|
1 |
|
public function getMunicipality(): ?string |
83
|
|
|
{ |
84
|
|
|
return $this->municipality; |
85
|
1 |
|
} |
86
|
|
|
|
87
|
1 |
|
public function setMunicipality(?string $municipality): void |
88
|
|
|
{ |
89
|
|
|
$this->municipality = $municipality; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return array<string,string|int|null> |
94
|
|
|
*/ |
95
|
|
|
public function toArray(): array |
96
|
|
|
{ |
97
|
|
|
return [ |
98
|
|
|
Property::COUNTRY_ID->value => $this->countryId, |
99
|
|
|
Property::NAME->value => $this->name, |
100
|
|
|
Property::POST_CODE->value => $this->postCode |
101
|
|
|
]; |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|