3 namespace OpenEMR\FHIR\R4\FHIRElement
;
6 * This class was generated with the PHPFHIR library (https://github.com/dcarbone/php-fhir) using
7 * class definitions from HL7 FHIR (https://www.hl7.org/fhir/)
9 * Class creation date: June 14th, 2019
13 * Copyright 2016-2017 Daniel Carbone (daniel.p.carbone@gmail.com)
15 * Licensed under the Apache License, Version 2.0 (the "License");
16 * you may not use this file except in compliance with the License.
17 * You may obtain a copy of the License at
19 * http://www.apache.org/licenses/LICENSE-2.0
21 * Unless required by applicable law or agreed to in writing, software
22 * distributed under the License is distributed on an "AS IS" BASIS,
23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 * See the License for the specific language governing permissions and
25 * limitations under the License.
28 * FHIR Copyright Notice:
30 * Copyright (c) 2011+, HL7, Inc.
31 * All rights reserved.
33 * Redistribution and use in source and binary forms, with or without modification,
34 * are permitted provided that the following conditions are met:
36 * * Redistributions of source code must retain the above copyright notice, this
37 * list of conditions and the following disclaimer.
38 * * Redistributions in binary form must reproduce the above copyright notice,
39 * this list of conditions and the following disclaimer in the documentation
40 * and/or other materials provided with the distribution.
41 * * Neither the name of HL7 nor the names of its contributors may be used to
42 * endorse or promote products derived from this software without specific
43 * prior written permission.
45 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
47 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
48 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
49 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
51 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
52 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
54 * POSSIBILITY OF SUCH DAMAGE.
57 * Generated on Thu, Dec 27, 2018 22:37+1100 for FHIR v4.0.0
59 * Note: the schemas & schematrons do not contain all of the rules about what makes resources
60 * valid. Implementers will still need to be familiar with the content of the specification and with
61 * any profiles that apply to the resources in order to make a conformant implementation.
65 use OpenEMR\FHIR\R4\FHIRElement
;
68 * An address expressed using postal conventions (as opposed to GPS or other location definition formats). This data type may be used to convey addresses for use in delivering mail as well as for visiting locations which might not be valid for mail delivery. There are a variety of postal address formats defined around the world.
69 * If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions
71 class FHIRAddress
extends FHIRElement
implements \JsonSerializable
74 * The purpose of this address.
75 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRAddressUse
80 * Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.
81 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRAddressType
86 * Specifies the entire address as it should be displayed e.g. on a postal label. This may be provided instead of or as well as the specific parts.
87 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
92 * This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.
93 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString[]
98 * The name of the city, town, suburb, village or other community or delivery center.
99 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
104 * The name of the administrative area (county).
105 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
107 public $district = null;
110 * Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (e.g. US 2 letter state codes).
111 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
113 public $state = null;
116 * A postal code designating a region defined by the postal service.
117 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
119 public $postalCode = null;
122 * Country - a nation as commonly understood or generally accepted.
123 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
125 public $country = null;
128 * Time period when address was/is in use.
129 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod
131 public $period = null;
136 private $_fhirElementName = 'Address';
139 * The purpose of this address.
140 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRAddressUse
142 public function getUse()
148 * The purpose of this address.
149 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRAddressUse $use
152 public function setUse($use)
159 * Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.
160 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRAddressType
162 public function getType()
168 * Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.
169 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRAddressType $type
172 public function setType($type)
179 * Specifies the entire address as it should be displayed e.g. on a postal label. This may be provided instead of or as well as the specific parts.
180 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
182 public function getText()
188 * Specifies the entire address as it should be displayed e.g. on a postal label. This may be provided instead of or as well as the specific parts.
189 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $text
192 public function setText($text)
199 * This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.
200 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString[]
202 public function getLine()
208 * This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.
209 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $line
212 public function addLine($line)
214 $this->line
[] = $line;
219 * The name of the city, town, suburb, village or other community or delivery center.
220 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
222 public function getCity()
228 * The name of the city, town, suburb, village or other community or delivery center.
229 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $city
232 public function setCity($city)
239 * The name of the administrative area (county).
240 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
242 public function getDistrict()
244 return $this->district
;
248 * The name of the administrative area (county).
249 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $district
252 public function setDistrict($district)
254 $this->district
= $district;
259 * Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (e.g. US 2 letter state codes).
260 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
262 public function getState()
268 * Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (e.g. US 2 letter state codes).
269 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $state
272 public function setState($state)
274 $this->state
= $state;
279 * A postal code designating a region defined by the postal service.
280 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
282 public function getPostalCode()
284 return $this->postalCode
;
288 * A postal code designating a region defined by the postal service.
289 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $postalCode
292 public function setPostalCode($postalCode)
294 $this->postalCode
= $postalCode;
299 * Country - a nation as commonly understood or generally accepted.
300 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
302 public function getCountry()
304 return $this->country
;
308 * Country - a nation as commonly understood or generally accepted.
309 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $country
312 public function setCountry($country)
314 $this->country
= $country;
319 * Time period when address was/is in use.
320 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod
322 public function getPeriod()
324 return $this->period
;
328 * Time period when address was/is in use.
329 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod $period
332 public function setPeriod($period)
334 $this->period
= $period;
341 public function get_fhirElementName()
343 return $this->_fhirElementName
;
349 public function __construct($data = [])
351 if (is_array($data)) {
352 if (isset($data['use'])) {
353 $this->setUse($data['use']);
355 if (isset($data['type'])) {
356 $this->setType($data['type']);
358 if (isset($data['text'])) {
359 $this->setText($data['text']);
361 if (isset($data['line'])) {
362 if (is_array($data['line'])) {
363 foreach ($data['line'] as $d) {
367 throw new \
InvalidArgumentException('"line" must be array of objects or null, ' . gettype($data['line']) . ' seen.');
370 if (isset($data['city'])) {
371 $this->setCity($data['city']);
373 if (isset($data['district'])) {
374 $this->setDistrict($data['district']);
376 if (isset($data['state'])) {
377 $this->setState($data['state']);
379 if (isset($data['postalCode'])) {
380 $this->setPostalCode($data['postalCode']);
382 if (isset($data['country'])) {
383 $this->setCountry($data['country']);
385 if (isset($data['period'])) {
386 $this->setPeriod($data['period']);
388 } elseif (null !== $data) {
389 throw new \
InvalidArgumentException('$data expected to be array of values, saw "' . gettype($data) . '"');
391 parent
::__construct($data);
397 public function __toString()
399 return $this->get_fhirElementName();
405 public function jsonSerialize(): mixed
407 $json = parent
::jsonSerialize();
408 if (isset($this->use)) {
409 $json['use'] = $this->use;
411 if (isset($this->type
)) {
412 $json['type'] = $this->type
;
414 if (isset($this->text
)) {
415 $json['text'] = $this->text
;
417 if (0 < count($this->line
)) {
419 foreach ($this->line
as $line) {
420 $json['line'][] = $line;
423 if (isset($this->city
)) {
424 $json['city'] = $this->city
;
426 if (isset($this->district
)) {
427 $json['district'] = $this->district
;
429 if (isset($this->state
)) {
430 $json['state'] = $this->state
;
432 if (isset($this->postalCode
)) {
433 $json['postalCode'] = $this->postalCode
;
435 if (isset($this->country
)) {
436 $json['country'] = $this->country
;
438 if (isset($this->period
)) {
439 $json['period'] = $this->period
;
445 * @param boolean $returnSXE
446 * @param \SimpleXMLElement $sxe
447 * @return string|\SimpleXMLElement
449 public function xmlSerialize($returnSXE = false, $sxe = null)
452 $sxe = new \
SimpleXMLElement('<Address xmlns="http://hl7.org/fhir"></Address>');
454 parent
::xmlSerialize(true, $sxe);
455 if (isset($this->use)) {
456 $this->use->xmlSerialize(true, $sxe->addChild('use'));
458 if (isset($this->type
)) {
459 $this->type
->xmlSerialize(true, $sxe->addChild('type'));
461 if (isset($this->text
)) {
462 $this->text
->xmlSerialize(true, $sxe->addChild('text'));
464 if (0 < count($this->line
)) {
465 foreach ($this->line
as $line) {
466 $line->xmlSerialize(true, $sxe->addChild('line'));
469 if (isset($this->city
)) {
470 $this->city
->xmlSerialize(true, $sxe->addChild('city'));
472 if (isset($this->district
)) {
473 $this->district
->xmlSerialize(true, $sxe->addChild('district'));
475 if (isset($this->state
)) {
476 $this->state
->xmlSerialize(true, $sxe->addChild('state'));
478 if (isset($this->postalCode
)) {
479 $this->postalCode
->xmlSerialize(true, $sxe->addChild('postalCode'));
481 if (isset($this->country
)) {
482 $this->country
->xmlSerialize(true, $sxe->addChild('country'));
484 if (isset($this->period
)) {
485 $this->period
->xmlSerialize(true, $sxe->addChild('period'));
490 return $sxe->saveXML();