#7914 - Fix for contacts being empty or s tring (#7915)
[openemr.git] / src / FHIR / R4 / FHIRElement / FHIRCoding.php
blob0b17a249d7dc04bb7d3f59a7a8a769e639022341
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 * A reference to a code defined by a terminology system.
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 FHIRCoding extends FHIRElement implements \JsonSerializable
73 /**
74 * The identification of the code system that defines the meaning of the symbol in the code.
75 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRUri
77 public $system = null;
79 /**
80 * The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured, and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.
81 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
83 public $version = null;
85 /**
86 * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).
87 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCode
89 public $code = null;
91 /**
92 * A representation of the meaning of the code in the system, following the rules of the system.
93 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
95 public $display = null;
97 /**
98 * Indicates that this coding was chosen by a user directly - e.g. off a pick list of available items (codes or displays).
99 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRBoolean
101 public $userSelected = null;
104 * @var string
106 private $_fhirElementName = 'Coding';
109 * The identification of the code system that defines the meaning of the symbol in the code.
110 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRUri
112 public function getSystem()
114 return $this->system;
118 * The identification of the code system that defines the meaning of the symbol in the code.
119 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRUri $system
120 * @return $this
122 public function setSystem($system)
124 $this->system = $system;
125 return $this;
129 * The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured, and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.
130 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
132 public function getVersion()
134 return $this->version;
138 * The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured, and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.
139 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $version
140 * @return $this
142 public function setVersion($version)
144 $this->version = $version;
145 return $this;
149 * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).
150 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCode
152 public function getCode()
154 return $this->code;
158 * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).
159 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCode $code
160 * @return $this
162 public function setCode($code)
164 $this->code = $code;
165 return $this;
169 * A representation of the meaning of the code in the system, following the rules of the system.
170 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
172 public function getDisplay()
174 return $this->display;
178 * A representation of the meaning of the code in the system, following the rules of the system.
179 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $display
180 * @return $this
182 public function setDisplay($display)
184 $this->display = $display;
185 return $this;
189 * Indicates that this coding was chosen by a user directly - e.g. off a pick list of available items (codes or displays).
190 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRBoolean
192 public function getUserSelected()
194 return $this->userSelected;
198 * Indicates that this coding was chosen by a user directly - e.g. off a pick list of available items (codes or displays).
199 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRBoolean $userSelected
200 * @return $this
202 public function setUserSelected($userSelected)
204 $this->userSelected = $userSelected;
205 return $this;
209 * @return string
211 public function get_fhirElementName()
213 return $this->_fhirElementName;
217 * @param mixed $data
219 public function __construct($data = [])
221 if (is_array($data)) {
222 if (isset($data['system'])) {
223 $this->setSystem($data['system']);
225 if (isset($data['version'])) {
226 $this->setVersion($data['version']);
228 if (isset($data['code'])) {
229 $this->setCode($data['code']);
231 if (isset($data['display'])) {
232 $this->setDisplay($data['display']);
234 if (isset($data['userSelected'])) {
235 $this->setUserSelected($data['userSelected']);
237 } elseif (null !== $data) {
238 throw new \InvalidArgumentException('$data expected to be array of values, saw "' . gettype($data) . '"');
240 parent::__construct($data);
244 * @return string
246 public function __toString()
248 return $this->get_fhirElementName();
252 * @return array
254 public function jsonSerialize(): mixed
256 $json = parent::jsonSerialize();
257 if (isset($this->system)) {
258 $json['system'] = $this->system;
260 if (isset($this->version)) {
261 $json['version'] = $this->version;
263 if (isset($this->code)) {
264 $json['code'] = $this->code;
266 if (isset($this->display)) {
267 $json['display'] = $this->display;
269 if (isset($this->userSelected)) {
270 $json['userSelected'] = $this->userSelected;
272 return $json;
276 * @param boolean $returnSXE
277 * @param \SimpleXMLElement $sxe
278 * @return string|\SimpleXMLElement
280 public function xmlSerialize($returnSXE = false, $sxe = null)
282 if (null === $sxe) {
283 $sxe = new \SimpleXMLElement('<Coding xmlns="http://hl7.org/fhir"></Coding>');
285 parent::xmlSerialize(true, $sxe);
286 if (isset($this->system)) {
287 $this->system->xmlSerialize(true, $sxe->addChild('system'));
289 if (isset($this->version)) {
290 $this->version->xmlSerialize(true, $sxe->addChild('version'));
292 if (isset($this->code)) {
293 $this->code->xmlSerialize(true, $sxe->addChild('code'));
295 if (isset($this->display)) {
296 $this->display->xmlSerialize(true, $sxe->addChild('display'));
298 if (isset($this->userSelected)) {
299 $this->userSelected->xmlSerialize(true, $sxe->addChild('userSelected'));
301 if ($returnSXE) {
302 return $sxe;
304 return $sxe->saveXML();