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 * A human's name with the ability to identify parts and usage.
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 FHIRHumanName
extends FHIRElement
implements \JsonSerializable
74 * Identifies the purpose for this name.
75 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRNameUse
80 * Specifies the entire name as it should be displayed e.g. on an application UI. This may be provided instead of or as well as the specific parts.
81 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
86 * The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.
87 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
89 public $family = null;
93 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString[]
98 * Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.
99 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString[]
104 * Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.
105 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString[]
110 * Indicates the period of time when this name was valid for the named person.
111 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod
113 public $period = null;
118 private $_fhirElementName = 'HumanName';
121 * Identifies the purpose for this name.
122 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRNameUse
124 public function getUse()
130 * Identifies the purpose for this name.
131 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRNameUse $use
134 public function setUse($use)
141 * Specifies the entire name as it should be displayed e.g. on an application UI. This may be provided instead of or as well as the specific parts.
142 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
144 public function getText()
150 * Specifies the entire name as it should be displayed e.g. on an application UI. This may be provided instead of or as well as the specific parts.
151 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $text
154 public function setText($text)
161 * The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.
162 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
164 public function getFamily()
166 return $this->family
;
170 * The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.
171 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $family
174 public function setFamily($family)
176 $this->family
= $family;
182 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString[]
184 public function getGiven()
191 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $given
194 public function addGiven($given)
196 $this->given
[] = $given;
201 * Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.
202 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString[]
204 public function getPrefix()
206 return $this->prefix
;
210 * Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.
211 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $prefix
214 public function addPrefix($prefix)
216 $this->prefix
[] = $prefix;
221 * Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.
222 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString[]
224 public function getSuffix()
226 return $this->suffix
;
230 * Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.
231 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $suffix
234 public function addSuffix($suffix)
236 $this->suffix
[] = $suffix;
241 * Indicates the period of time when this name was valid for the named person.
242 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod
244 public function getPeriod()
246 return $this->period
;
250 * Indicates the period of time when this name was valid for the named person.
251 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod $period
254 public function setPeriod($period)
256 $this->period
= $period;
263 public function get_fhirElementName()
265 return $this->_fhirElementName
;
271 public function __construct($data = [])
273 if (is_array($data)) {
274 if (isset($data['use'])) {
275 $this->setUse($data['use']);
277 if (isset($data['text'])) {
278 $this->setText($data['text']);
280 if (isset($data['family'])) {
281 $this->setFamily($data['family']);
283 if (isset($data['given'])) {
284 if (is_array($data['given'])) {
285 foreach ($data['given'] as $d) {
289 throw new \
InvalidArgumentException('"given" must be array of objects or null, ' . gettype($data['given']) . ' seen.');
292 if (isset($data['prefix'])) {
293 if (is_array($data['prefix'])) {
294 foreach ($data['prefix'] as $d) {
295 $this->addPrefix($d);
298 throw new \
InvalidArgumentException('"prefix" must be array of objects or null, ' . gettype($data['prefix']) . ' seen.');
301 if (isset($data['suffix'])) {
302 if (is_array($data['suffix'])) {
303 foreach ($data['suffix'] as $d) {
304 $this->addSuffix($d);
307 throw new \
InvalidArgumentException('"suffix" must be array of objects or null, ' . gettype($data['suffix']) . ' seen.');
310 if (isset($data['period'])) {
311 $this->setPeriod($data['period']);
313 } elseif (null !== $data) {
314 throw new \
InvalidArgumentException('$data expected to be array of values, saw "' . gettype($data) . '"');
316 parent
::__construct($data);
322 public function __toString()
324 return $this->get_fhirElementName();
330 public function jsonSerialize(): mixed
332 $json = parent
::jsonSerialize();
333 if (isset($this->use)) {
334 $json['use'] = $this->use;
336 if (isset($this->text
)) {
337 $json['text'] = $this->text
;
339 if (isset($this->family
)) {
340 $json['family'] = $this->family
;
342 if (0 < count($this->given
)) {
344 foreach ($this->given
as $given) {
345 $json['given'][] = $given;
348 if (0 < count($this->prefix
)) {
349 $json['prefix'] = [];
350 foreach ($this->prefix
as $prefix) {
351 $json['prefix'][] = $prefix;
354 if (0 < count($this->suffix
)) {
355 $json['suffix'] = [];
356 foreach ($this->suffix
as $suffix) {
357 $json['suffix'][] = $suffix;
360 if (isset($this->period
)) {
361 $json['period'] = $this->period
;
367 * @param boolean $returnSXE
368 * @param \SimpleXMLElement $sxe
369 * @return string|\SimpleXMLElement
371 public function xmlSerialize($returnSXE = false, $sxe = null)
374 $sxe = new \
SimpleXMLElement('<HumanName xmlns="http://hl7.org/fhir"></HumanName>');
376 parent
::xmlSerialize(true, $sxe);
377 if (isset($this->use)) {
378 $this->use->xmlSerialize(true, $sxe->addChild('use'));
380 if (isset($this->text
)) {
381 $this->text
->xmlSerialize(true, $sxe->addChild('text'));
383 if (isset($this->family
)) {
384 $this->family
->xmlSerialize(true, $sxe->addChild('family'));
386 if (0 < count($this->given
)) {
387 foreach ($this->given
as $given) {
388 $given->xmlSerialize(true, $sxe->addChild('given'));
391 if (0 < count($this->prefix
)) {
392 foreach ($this->prefix
as $prefix) {
393 $prefix->xmlSerialize(true, $sxe->addChild('prefix'));
396 if (0 < count($this->suffix
)) {
397 foreach ($this->suffix
as $suffix) {
398 $suffix->xmlSerialize(true, $sxe->addChild('suffix'));
401 if (isset($this->period
)) {
402 $this->period
->xmlSerialize(true, $sxe->addChild('period'));
407 return $sxe->saveXML();