|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Drupal\os2web_datalookup\LookupResult; |
| 4 | + |
| 5 | +class CvrLookupResult { |
| 6 | + |
| 7 | + const CVR = 'cvr'; |
| 8 | + const NAME = 'name'; |
| 9 | + const STREET = 'street'; |
| 10 | + const HOUSE_NR = 'houseNr'; |
| 11 | + const FLOOR = 'floor'; |
| 12 | + const APARTMENT_NR = 'apartmentNr'; |
| 13 | + const POSTAL_CODE = 'postalCode'; |
| 14 | + const CITY = 'city'; |
| 15 | + const MUNICIPALITY_CODE = 'municipalityCode'; |
| 16 | + const ADDRESS = 'address'; |
| 17 | + |
| 18 | + /** |
| 19 | + * Is request successful. |
| 20 | + * |
| 21 | + * @var bool |
| 22 | + */ |
| 23 | + protected $successful = FALSE; |
| 24 | + |
| 25 | + /** |
| 26 | + * Status of the request. |
| 27 | + * |
| 28 | + * @var string |
| 29 | + */ |
| 30 | + protected $errorMessage; |
| 31 | + |
| 32 | + /** |
| 33 | + * CVR |
| 34 | + * |
| 35 | + * @var string |
| 36 | + */ |
| 37 | + protected $cvr; |
| 38 | + |
| 39 | + /** |
| 40 | + * Company name. |
| 41 | + * |
| 42 | + * @var string |
| 43 | + */ |
| 44 | + protected $name; |
| 45 | + |
| 46 | + /** |
| 47 | + * Street of the person. |
| 48 | + * |
| 49 | + * @var string |
| 50 | + */ |
| 51 | + protected $street; |
| 52 | + |
| 53 | + /** |
| 54 | + * Street house number of the person. |
| 55 | + * |
| 56 | + * @var string |
| 57 | + */ |
| 58 | + protected $houseNr; |
| 59 | + |
| 60 | + /** |
| 61 | + * Floor number the person. |
| 62 | + * |
| 63 | + * @var string |
| 64 | + */ |
| 65 | + protected $floor; |
| 66 | + |
| 67 | + /** |
| 68 | + * Apartment number of the person. |
| 69 | + * |
| 70 | + * @var string |
| 71 | + */ |
| 72 | + protected $apartmentNr; |
| 73 | + |
| 74 | + /** |
| 75 | + * Postal code of the person. |
| 76 | + * |
| 77 | + * @var string |
| 78 | + */ |
| 79 | + protected $postalCode; |
| 80 | + |
| 81 | + /** |
| 82 | + * City of the person. |
| 83 | + * |
| 84 | + * @var string |
| 85 | + */ |
| 86 | + protected $city; |
| 87 | + |
| 88 | + /** |
| 89 | + * Municipality code of the person. |
| 90 | + * |
| 91 | + * @var string |
| 92 | + */ |
| 93 | + protected $municipalityCode; |
| 94 | + |
| 95 | + /** |
| 96 | + * Address of the person. |
| 97 | + * |
| 98 | + * @var string |
| 99 | + */ |
| 100 | + protected $address; |
| 101 | + |
| 102 | + /** |
| 103 | + * @return bool |
| 104 | + */ |
| 105 | + public function isSuccessful(): bool { |
| 106 | + return $this->successful; |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * @param bool $successful |
| 111 | + */ |
| 112 | + public function setSuccessful(bool $successful = TRUE): void { |
| 113 | + $this->successful = $successful; |
| 114 | + } |
| 115 | + |
| 116 | + /** |
| 117 | + * @return string |
| 118 | + */ |
| 119 | + public function getErrorMessage(): string { |
| 120 | + return $this->errorMessage; |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * @param string $errorMessage |
| 125 | + */ |
| 126 | + public function setErrorMessage(string $errorMessage): void { |
| 127 | + $this->errorMessage = $errorMessage; |
| 128 | + } |
| 129 | + |
| 130 | + /** |
| 131 | + * @return string |
| 132 | + */ |
| 133 | + public function getCvr(): string { |
| 134 | + return $this->cvr; |
| 135 | + } |
| 136 | + |
| 137 | + /** |
| 138 | + * @param string $cpr |
| 139 | + */ |
| 140 | + public function setCvr(string $cpr): void { |
| 141 | + $this->cvr = $cpr; |
| 142 | + } |
| 143 | + |
| 144 | + /** |
| 145 | + * @return string |
| 146 | + */ |
| 147 | + public function getName(): string { |
| 148 | + return $this->name; |
| 149 | + } |
| 150 | + |
| 151 | + /** |
| 152 | + * @param string $name |
| 153 | + */ |
| 154 | + public function setName(string $name): void { |
| 155 | + $this->name = $name; |
| 156 | + } |
| 157 | + |
| 158 | + /** |
| 159 | + * @return string |
| 160 | + */ |
| 161 | + public function getStreet(): string { |
| 162 | + return $this->street; |
| 163 | + } |
| 164 | + |
| 165 | + /** |
| 166 | + * @param string $street |
| 167 | + */ |
| 168 | + public function setStreet(string $street): void { |
| 169 | + $this->street = $street; |
| 170 | + } |
| 171 | + |
| 172 | + /** |
| 173 | + * @return string |
| 174 | + */ |
| 175 | + public function getHouseNr(): string { |
| 176 | + return $this->houseNr; |
| 177 | + } |
| 178 | + |
| 179 | + /** |
| 180 | + * @param string $houseNr |
| 181 | + */ |
| 182 | + public function setHouseNr(string $houseNr): void { |
| 183 | + $this->houseNr = $houseNr; |
| 184 | + } |
| 185 | + |
| 186 | + /** |
| 187 | + * @return string |
| 188 | + */ |
| 189 | + public function getFloor(): string { |
| 190 | + return $this->floor; |
| 191 | + } |
| 192 | + |
| 193 | + /** |
| 194 | + * @param string $floor |
| 195 | + */ |
| 196 | + public function setFloor(string $floor): void { |
| 197 | + $this->floor = $floor; |
| 198 | + } |
| 199 | + |
| 200 | + /** |
| 201 | + * @return string |
| 202 | + */ |
| 203 | + public function getApartmentNr(): string { |
| 204 | + return $this->apartmentNr; |
| 205 | + } |
| 206 | + |
| 207 | + /** |
| 208 | + * @param string $apartmentNr |
| 209 | + */ |
| 210 | + public function setApartmentNr(string $apartmentNr): void { |
| 211 | + $this->apartmentNr = $apartmentNr; |
| 212 | + } |
| 213 | + |
| 214 | + /** |
| 215 | + * @return string |
| 216 | + */ |
| 217 | + public function getPostalCode(): string { |
| 218 | + return $this->postalCode; |
| 219 | + } |
| 220 | + |
| 221 | + /** |
| 222 | + * @param string $postalCode |
| 223 | + */ |
| 224 | + public function setPostalCode(string $postalCode): void { |
| 225 | + $this->postalCode = $postalCode; |
| 226 | + } |
| 227 | + |
| 228 | + /** |
| 229 | + * @return string |
| 230 | + */ |
| 231 | + public function getCity(): string { |
| 232 | + return $this->city; |
| 233 | + } |
| 234 | + |
| 235 | + /** |
| 236 | + * @param string $city |
| 237 | + */ |
| 238 | + public function setCity(string $city): void { |
| 239 | + $this->city = $city; |
| 240 | + } |
| 241 | + |
| 242 | + /** |
| 243 | + * @return string |
| 244 | + */ |
| 245 | + public function getMunicipalityCode(): string { |
| 246 | + return $this->municipalityCode; |
| 247 | + } |
| 248 | + |
| 249 | + /** |
| 250 | + * @param string $municipalityCode |
| 251 | + */ |
| 252 | + public function setMunicipalityCode(string $municipalityCode): void { |
| 253 | + $this->municipalityCode = $municipalityCode; |
| 254 | + } |
| 255 | + |
| 256 | + /** |
| 257 | + * @return string |
| 258 | + */ |
| 259 | + public function getAddress(): string { |
| 260 | + return $this->address; |
| 261 | + } |
| 262 | + |
| 263 | + /** |
| 264 | + * @param string $address |
| 265 | + */ |
| 266 | + public function setAddress(string $address): void { |
| 267 | + $this->address = $address; |
| 268 | + } |
| 269 | + |
| 270 | + /** |
| 271 | + * Returns the value of the provided field. |
| 272 | + * |
| 273 | + * @param $field |
| 274 | + * Field name. |
| 275 | + * |
| 276 | + * @return mixed |
| 277 | + */ |
| 278 | + public function getFieldValue($field) { |
| 279 | + if (property_exists($this, $field)) { |
| 280 | + return $this->{$field}; |
| 281 | + } |
| 282 | + |
| 283 | + return ''; |
| 284 | + } |
| 285 | + |
| 286 | +} |
0 commit comments