chore(deps): bump twig/twig from 3.17.1 to 3.19.0 (#7951)
[openemr.git] / src / FHIR / R4 / FHIRElement / FHIRCodeableConcept.php
blob3a5edee419746bfe4a73ca0116cfe50dbcb40ed8
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 concept that may be defined by a formal reference to a terminology or ontology or may be provided by text.
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 FHIRCodeableConcept extends FHIRElement implements \JsonSerializable
73 /**
74 * A reference to a code defined by a terminology system.
75 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding[]
77 public $coding = [];
79 /**
80 * A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.
81 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
83 public $text = null;
85 /**
86 * @var string
88 private $_fhirElementName = 'CodeableConcept';
90 /**
91 * A reference to a code defined by a terminology system.
92 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding[]
94 public function getCoding()
96 return $this->coding;
99 /**
100 * A reference to a code defined by a terminology system.
101 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding $coding
102 * @return $this
104 public function addCoding($coding)
106 $this->coding[] = $coding;
107 return $this;
111 * A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.
112 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
114 public function getText()
116 return $this->text;
120 * A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.
121 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $text
122 * @return $this
124 public function setText($text)
126 $this->text = $text;
127 return $this;
131 * @return string
133 public function get_fhirElementName()
135 return $this->_fhirElementName;
139 * @param mixed $data
141 public function __construct($data = [])
143 if (is_array($data)) {
144 if (isset($data['coding'])) {
145 if (is_array($data['coding'])) {
146 foreach ($data['coding'] as $d) {
147 $this->addCoding($d);
149 } else {
150 throw new \InvalidArgumentException('"coding" must be array of objects or null, ' . gettype($data['coding']) . ' seen.');
153 if (isset($data['text'])) {
154 $this->setText($data['text']);
156 } elseif (null !== $data) {
157 throw new \InvalidArgumentException('$data expected to be array of values, saw "' . gettype($data) . '"');
159 parent::__construct($data);
163 * @return string
165 public function __toString()
167 return $this->get_fhirElementName();
171 * @return array
173 public function jsonSerialize(): mixed
175 $json = parent::jsonSerialize();
176 if (0 < count($this->coding)) {
177 $json['coding'] = [];
178 foreach ($this->coding as $coding) {
179 $json['coding'][] = $coding;
182 if (isset($this->text)) {
183 $json['text'] = $this->text;
185 return $json;
189 * @param boolean $returnSXE
190 * @param \SimpleXMLElement $sxe
191 * @return string|\SimpleXMLElement
193 public function xmlSerialize($returnSXE = false, $sxe = null)
195 if (null === $sxe) {
196 $sxe = new \SimpleXMLElement('<CodeableConcept xmlns="http://hl7.org/fhir"></CodeableConcept>');
198 parent::xmlSerialize(true, $sxe);
199 if (0 < count($this->coding)) {
200 foreach ($this->coding as $coding) {
201 $coding->xmlSerialize(true, $sxe->addChild('coding'));
204 if (isset($this->text)) {
205 $this->text->xmlSerialize(true, $sxe->addChild('text'));
207 if ($returnSXE) {
208 return $sxe;
210 return $sxe->saveXML();