1 | <?php |
||
25 | class SearchRequest extends AbstractRequest { |
||
26 | |||
27 | use FloatLatTrait; |
||
28 | use FloatLonTrait; |
||
29 | use StringTypeTrait; |
||
30 | |||
31 | /** |
||
32 | * Resource path. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | const RESOURCE_PATH = "/search/"; |
||
37 | |||
38 | /** |
||
39 | * Type "house number". |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | const TYPE_HOUSE_NUMBER = "housenumber"; |
||
44 | |||
45 | /** |
||
46 | * Type "locality". |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | const TYPE_LOCALITY = "locality"; |
||
51 | |||
52 | /** |
||
53 | * Type "municipality". |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | const TYPE_MUNICIPALITY = "municipality"; |
||
58 | |||
59 | /** |
||
60 | * Type "street". |
||
61 | * |
||
62 | * @var string |
||
63 | */ |
||
64 | const TYPE_STREET = "street"; |
||
65 | |||
66 | /** |
||
67 | * Autocomplete. |
||
68 | * |
||
69 | * @var bool|null |
||
70 | */ |
||
71 | private $autocomplete; |
||
72 | |||
73 | /** |
||
74 | * City code. |
||
75 | * |
||
76 | * @var string|null |
||
77 | */ |
||
78 | private $cityCode; |
||
79 | |||
80 | /** |
||
81 | * Limit. |
||
82 | * |
||
83 | * @var int|null |
||
84 | */ |
||
85 | private $limit; |
||
86 | |||
87 | /** |
||
88 | * Postcode. |
||
89 | * |
||
90 | * @var string|null |
||
91 | */ |
||
92 | private $postcode; |
||
93 | |||
94 | /** |
||
95 | * Query. |
||
96 | * |
||
97 | * @var string|null |
||
98 | */ |
||
99 | private $q; |
||
100 | |||
101 | /** |
||
102 | * Constructor. |
||
103 | * |
||
104 | * @param string|null $q The query. |
||
105 | */ |
||
106 | public function __construct(string $q = null) { |
||
110 | |||
111 | /** |
||
112 | * Enumerates the types. |
||
113 | * |
||
114 | * @return string[] Returns the types. |
||
115 | */ |
||
116 | public static function enumTypes(): array { |
||
124 | |||
125 | /** |
||
126 | * Get the autocomplete. |
||
127 | * |
||
128 | * @return bool|null Returns the autocomplete. |
||
129 | */ |
||
130 | public function getAutocomplete(): ?bool { |
||
133 | |||
134 | /** |
||
135 | * Get the city code. |
||
136 | * |
||
137 | * @return string|null Returns the city code. |
||
138 | */ |
||
139 | public function getCityCode(): ?string { |
||
142 | |||
143 | /** |
||
144 | * Get the limit. |
||
145 | * |
||
146 | * @return int|null Returns the limit. |
||
147 | */ |
||
148 | public function getLimit(): ?int { |
||
151 | |||
152 | /** |
||
153 | * Get the postcode. |
||
154 | * |
||
155 | * @return string|null Returns the postcode. |
||
156 | */ |
||
157 | public function getPostcode(): ?string { |
||
160 | |||
161 | /** |
||
162 | * Get the query. |
||
163 | * |
||
164 | * @return string|null Returns the query. |
||
165 | */ |
||
166 | public function getQ(): ?string { |
||
169 | |||
170 | /** |
||
171 | * {@inheritDoc} |
||
172 | */ |
||
173 | public function getResourcePath(): string { |
||
176 | |||
177 | /** |
||
178 | * Get the autocomplete. |
||
179 | * |
||
180 | * @param bool|null $autocomplete The autocomplete. |
||
181 | * @return SearchRequest Returns this search request. |
||
182 | */ |
||
183 | public function setAutocomplete(?bool $autocomplete): SearchRequest { |
||
187 | |||
188 | /** |
||
189 | * Set the city code. |
||
190 | * |
||
191 | * @param string|null $cityCode The city code. |
||
192 | * @return SearchRequest Returns this search request. |
||
193 | */ |
||
194 | public function setCityCode(?string $cityCode): SearchRequest { |
||
198 | |||
199 | /** |
||
200 | * Set the limit. |
||
201 | * |
||
202 | * @param int|null $limit The limit. |
||
203 | * @return SearchRequest Returns this search request. |
||
204 | */ |
||
205 | public function setLimit(?int $limit): SearchRequest { |
||
209 | |||
210 | /** |
||
211 | * Set the postcode. |
||
212 | * |
||
213 | * @param string|null $postcode The postcode. |
||
214 | * @return SearchRequest Returns this search request. |
||
215 | */ |
||
216 | public function setPostcode(?string $postcode): SearchRequest { |
||
220 | |||
221 | /** |
||
222 | * Set the query. |
||
223 | * |
||
224 | * @param string|null $q The query. |
||
225 | * @return SearchRequest Returns this search request. |
||
226 | */ |
||
227 | public function setQ(?string $q): SearchRequest { |
||
231 | } |