#7914 - Fix for contacts being empty or s tring (#7915)
[openemr.git] / src / FHIR / R4 / FHIRElement / FHIRIdentifier.php
blob26c446788a6a6b49e5caedc587b5c65bbda1a05a
1 <?php
3 namespace OpenEMR\FHIR\R4\FHIRElement;
5 /*!
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
11 * PHPFHIR Copyright:
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;
67 /**
68 * An identifier - identifies some entity uniquely and unambiguously. Typically this is used for business identifiers.
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 FHIRIdentifier extends FHIRElement implements \JsonSerializable
73 /**
74 * The purpose of this identifier.
75 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRIdentifierUse
77 public $use = null;
79 /**
80 * A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.
81 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept
83 public $type = null;
85 /**
86 * Establishes the namespace for the value - that is, a URL that describes a set values that are unique.
87 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRUri
89 public $system = null;
91 /**
92 * The portion of the identifier typically relevant to the user and which is unique within the context of the system.
93 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
95 public $value = null;
97 /**
98 * Time period during which identifier is/was valid for use.
99 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod
101 public $period = null;
104 * Organization that issued/manages the identifier.
105 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRReference
107 public $assigner = null;
110 * @var string
112 private $_fhirElementName = 'Identifier';
115 * The purpose of this identifier.
116 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRIdentifierUse
118 public function getUse()
120 return $this->use;
124 * The purpose of this identifier.
125 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRIdentifierUse $use
126 * @return $this
128 public function setUse($use)
130 $this->use = $use;
131 return $this;
135 * A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.
136 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept
138 public function getType()
140 return $this->type;
144 * A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.
145 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept $type
146 * @return $this
148 public function setType($type)
150 $this->type = $type;
151 return $this;
155 * Establishes the namespace for the value - that is, a URL that describes a set values that are unique.
156 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRUri
158 public function getSystem()
160 return $this->system;
164 * Establishes the namespace for the value - that is, a URL that describes a set values that are unique.
165 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRUri $system
166 * @return $this
168 public function setSystem($system)
170 $this->system = $system;
171 return $this;
175 * The portion of the identifier typically relevant to the user and which is unique within the context of the system.
176 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
178 public function getValue()
180 return $this->value;
184 * The portion of the identifier typically relevant to the user and which is unique within the context of the system.
185 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $value
186 * @return $this
188 public function setValue($value)
190 $this->value = $value;
191 return $this;
195 * Time period during which identifier is/was valid for use.
196 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod
198 public function getPeriod()
200 return $this->period;
204 * Time period during which identifier is/was valid for use.
205 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod $period
206 * @return $this
208 public function setPeriod($period)
210 $this->period = $period;
211 return $this;
215 * Organization that issued/manages the identifier.
216 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRReference
218 public function getAssigner()
220 return $this->assigner;
224 * Organization that issued/manages the identifier.
225 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRReference $assigner
226 * @return $this
228 public function setAssigner($assigner)
230 $this->assigner = $assigner;
231 return $this;
235 * @return string
237 public function get_fhirElementName()
239 return $this->_fhirElementName;
243 * @param mixed $data
245 public function __construct($data = [])
247 if (is_array($data)) {
248 if (isset($data['use'])) {
249 $this->setUse($data['use']);
251 if (isset($data['type'])) {
252 $this->setType($data['type']);
254 if (isset($data['system'])) {
255 $this->setSystem($data['system']);
257 if (isset($data['value'])) {
258 $this->setValue($data['value']);
260 if (isset($data['period'])) {
261 $this->setPeriod($data['period']);
263 if (isset($data['assigner'])) {
264 $this->setAssigner($data['assigner']);
266 } elseif (null !== $data) {
267 throw new \InvalidArgumentException('$data expected to be array of values, saw "' . gettype($data) . '"');
269 parent::__construct($data);
273 * @return string
275 public function __toString()
277 return (string)$this->getValue();
281 * @return array
283 public function jsonSerialize(): mixed
285 $json = parent::jsonSerialize();
286 if (isset($this->use)) {
287 $json['use'] = $this->use;
289 if (isset($this->type)) {
290 $json['type'] = $this->type;
292 if (isset($this->system)) {
293 $json['system'] = $this->system;
295 if (isset($this->value)) {
296 $json['value'] = $this->value;
298 if (isset($this->period)) {
299 $json['period'] = $this->period;
301 if (isset($this->assigner)) {
302 $json['assigner'] = $this->assigner;
304 return $json;
308 * @param boolean $returnSXE
309 * @param \SimpleXMLElement $sxe
310 * @return string|\SimpleXMLElement
312 public function xmlSerialize($returnSXE = false, $sxe = null)
314 if (null === $sxe) {
315 $sxe = new \SimpleXMLElement('<Identifier xmlns="http://hl7.org/fhir"></Identifier>');
317 parent::xmlSerialize(true, $sxe);
318 if (isset($this->use)) {
319 $this->use->xmlSerialize(true, $sxe->addChild('use'));
321 if (isset($this->type)) {
322 $this->type->xmlSerialize(true, $sxe->addChild('type'));
324 if (isset($this->system)) {
325 $this->system->xmlSerialize(true, $sxe->addChild('system'));
327 if (isset($this->value)) {
328 $this->value->xmlSerialize(true, $sxe->addChild('value'));
330 if (isset($this->period)) {
331 $this->period->xmlSerialize(true, $sxe->addChild('period'));
333 if (isset($this->assigner)) {
334 $this->assigner->xmlSerialize(true, $sxe->addChild('assigner'));
336 if ($returnSXE) {
337 return $sxe;
339 return $sxe->saveXML();