#7914 - Fix for contacts being empty or s tring (#7915)
[openemr.git] / src / FHIR / R4 / FHIRElement / FHIRRelatedArtifact.php
blobcce874f8381aa5ce4bba15aa6b559a7b7efce7d6
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 * Related artifacts such as additional documentation, justification, or bibliographic references.
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 FHIRRelatedArtifact extends FHIRElement implements \JsonSerializable
73 /**
74 * The type of relationship to the related artifact.
75 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRRelatedArtifactType
77 public $type = null;
79 /**
80 * A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
81 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
83 public $label = null;
85 /**
86 * A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
87 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
89 public $display = null;
91 /**
92 * A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
93 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRMarkdown
95 public $citation = null;
97 /**
98 * A url for the artifact that can be followed to access the actual content.
99 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRUrl
101 public $url = null;
104 * The document being referenced, represented as an attachment. This is exclusive with the resource element.
105 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRAttachment
107 public $document = null;
110 * The related resource, such as a library, value set, profile, or other knowledge resource.
111 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCanonical
113 public $resource = null;
116 * @var string
118 private $_fhirElementName = 'RelatedArtifact';
121 * The type of relationship to the related artifact.
122 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRRelatedArtifactType
124 public function getType()
126 return $this->type;
130 * The type of relationship to the related artifact.
131 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRRelatedArtifactType $type
132 * @return $this
134 public function setType($type)
136 $this->type = $type;
137 return $this;
141 * A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
142 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
144 public function getLabel()
146 return $this->label;
150 * A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
151 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $label
152 * @return $this
154 public function setLabel($label)
156 $this->label = $label;
157 return $this;
161 * A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
162 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
164 public function getDisplay()
166 return $this->display;
170 * A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
171 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $display
172 * @return $this
174 public function setDisplay($display)
176 $this->display = $display;
177 return $this;
181 * A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
182 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRMarkdown
184 public function getCitation()
186 return $this->citation;
190 * A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
191 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRMarkdown $citation
192 * @return $this
194 public function setCitation($citation)
196 $this->citation = $citation;
197 return $this;
201 * A url for the artifact that can be followed to access the actual content.
202 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRUrl
204 public function getUrl()
206 return $this->url;
210 * A url for the artifact that can be followed to access the actual content.
211 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRUrl $url
212 * @return $this
214 public function setUrl($url)
216 $this->url = $url;
217 return $this;
221 * The document being referenced, represented as an attachment. This is exclusive with the resource element.
222 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRAttachment
224 public function getDocument()
226 return $this->document;
230 * The document being referenced, represented as an attachment. This is exclusive with the resource element.
231 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRAttachment $document
232 * @return $this
234 public function setDocument($document)
236 $this->document = $document;
237 return $this;
241 * The related resource, such as a library, value set, profile, or other knowledge resource.
242 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCanonical
244 public function getResource()
246 return $this->resource;
250 * The related resource, such as a library, value set, profile, or other knowledge resource.
251 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCanonical $resource
252 * @return $this
254 public function setResource($resource)
256 $this->resource = $resource;
257 return $this;
261 * @return string
263 public function get_fhirElementName()
265 return $this->_fhirElementName;
269 * @param mixed $data
271 public function __construct($data = [])
273 if (is_array($data)) {
274 if (isset($data['type'])) {
275 $this->setType($data['type']);
277 if (isset($data['label'])) {
278 $this->setLabel($data['label']);
280 if (isset($data['display'])) {
281 $this->setDisplay($data['display']);
283 if (isset($data['citation'])) {
284 $this->setCitation($data['citation']);
286 if (isset($data['url'])) {
287 $this->setUrl($data['url']);
289 if (isset($data['document'])) {
290 $this->setDocument($data['document']);
292 if (isset($data['resource'])) {
293 $this->setResource($data['resource']);
295 } elseif (null !== $data) {
296 throw new \InvalidArgumentException('$data expected to be array of values, saw "' . gettype($data) . '"');
298 parent::__construct($data);
302 * @return string
304 public function __toString()
306 return $this->get_fhirElementName();
310 * @return array
312 public function jsonSerialize(): mixed
314 $json = parent::jsonSerialize();
315 if (isset($this->type)) {
316 $json['type'] = $this->type;
318 if (isset($this->label)) {
319 $json['label'] = $this->label;
321 if (isset($this->display)) {
322 $json['display'] = $this->display;
324 if (isset($this->citation)) {
325 $json['citation'] = $this->citation;
327 if (isset($this->url)) {
328 $json['url'] = $this->url;
330 if (isset($this->document)) {
331 $json['document'] = $this->document;
333 if (isset($this->resource)) {
334 $json['resource'] = $this->resource;
336 return $json;
340 * @param boolean $returnSXE
341 * @param \SimpleXMLElement $sxe
342 * @return string|\SimpleXMLElement
344 public function xmlSerialize($returnSXE = false, $sxe = null)
346 if (null === $sxe) {
347 $sxe = new \SimpleXMLElement('<RelatedArtifact xmlns="http://hl7.org/fhir"></RelatedArtifact>');
349 parent::xmlSerialize(true, $sxe);
350 if (isset($this->type)) {
351 $this->type->xmlSerialize(true, $sxe->addChild('type'));
353 if (isset($this->label)) {
354 $this->label->xmlSerialize(true, $sxe->addChild('label'));
356 if (isset($this->display)) {
357 $this->display->xmlSerialize(true, $sxe->addChild('display'));
359 if (isset($this->citation)) {
360 $this->citation->xmlSerialize(true, $sxe->addChild('citation'));
362 if (isset($this->url)) {
363 $this->url->xmlSerialize(true, $sxe->addChild('url'));
365 if (isset($this->document)) {
366 $this->document->xmlSerialize(true, $sxe->addChild('document'));
368 if (isset($this->resource)) {
369 $this->resource->xmlSerialize(true, $sxe->addChild('resource'));
371 if ($returnSXE) {
372 return $sxe;
374 return $sxe->saveXML();