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 * For referring to data content defined in other formats.
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 FHIRAttachment
extends FHIRElement
implements \JsonSerializable
74 * Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.
75 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCode
77 public $contentType = null;
80 * The human language of the content. The value can be any valid value according to BCP 47.
81 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCode
83 public $language = null;
86 * The actual data of the attachment - a sequence of bytes, base64 encoded.
87 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRBase64Binary
92 * A location where the data can be accessed.
93 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRUrl
98 * The number of bytes of data that make up this attachment (before base64 encoding, if that is done).
99 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRUnsignedInt
104 * The calculated hash of the data using SHA-1. Represented using base64.
105 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRBase64Binary
110 * A label or set of text to display in place of the data.
111 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRString
113 public $title = null;
116 * The date that the attachment was first created.
117 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRDateTime
119 public $creation = null;
124 private $_fhirElementName = 'Attachment';
127 * Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.
128 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCode
130 public function getContentType()
132 return $this->contentType
;
136 * Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.
137 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCode $contentType
140 public function setContentType($contentType)
142 $this->contentType
= $contentType;
147 * The human language of the content. The value can be any valid value according to BCP 47.
148 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCode
150 public function getLanguage()
152 return $this->language
;
156 * The human language of the content. The value can be any valid value according to BCP 47.
157 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCode $language
160 public function setLanguage($language)
162 $this->language
= $language;
167 * The actual data of the attachment - a sequence of bytes, base64 encoded.
168 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRBase64Binary
170 public function getData()
176 * The actual data of the attachment - a sequence of bytes, base64 encoded.
177 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRBase64Binary $data
180 public function setData($data)
187 * A location where the data can be accessed.
188 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRUrl
190 public function getUrl()
196 * A location where the data can be accessed.
197 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRUrl $url
200 public function setUrl($url)
207 * The number of bytes of data that make up this attachment (before base64 encoding, if that is done).
208 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRUnsignedInt
210 public function getSize()
216 * The number of bytes of data that make up this attachment (before base64 encoding, if that is done).
217 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRUnsignedInt $size
220 public function setSize($size)
227 * The calculated hash of the data using SHA-1. Represented using base64.
228 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRBase64Binary
230 public function getHash()
236 * The calculated hash of the data using SHA-1. Represented using base64.
237 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRBase64Binary $hash
240 public function setHash($hash)
247 * A label or set of text to display in place of the data.
248 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRString
250 public function getTitle()
256 * A label or set of text to display in place of the data.
257 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRString $title
260 public function setTitle($title)
262 $this->title
= $title;
267 * The date that the attachment was first created.
268 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRDateTime
270 public function getCreation()
272 return $this->creation
;
276 * The date that the attachment was first created.
277 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRDateTime $creation
280 public function setCreation($creation)
282 $this->creation
= $creation;
289 public function get_fhirElementName()
291 return $this->_fhirElementName
;
297 public function __construct($data = [])
299 if (is_array($data)) {
300 if (isset($data['contentType'])) {
301 $this->setContentType($data['contentType']);
303 if (isset($data['language'])) {
304 $this->setLanguage($data['language']);
306 if (isset($data['data'])) {
307 $this->setData($data['data']);
309 if (isset($data['url'])) {
310 $this->setUrl($data['url']);
312 if (isset($data['size'])) {
313 $this->setSize($data['size']);
315 if (isset($data['hash'])) {
316 $this->setHash($data['hash']);
318 if (isset($data['title'])) {
319 $this->setTitle($data['title']);
321 if (isset($data['creation'])) {
322 $this->setCreation($data['creation']);
324 } elseif (null !== $data) {
325 throw new \
InvalidArgumentException('$data expected to be array of values, saw "' . gettype($data) . '"');
327 parent
::__construct($data);
333 public function __toString()
335 return $this->get_fhirElementName();
341 public function jsonSerialize(): mixed
343 $json = parent
::jsonSerialize();
344 if (isset($this->contentType
)) {
345 $json['contentType'] = $this->contentType
;
347 if (isset($this->language
)) {
348 $json['language'] = $this->language
;
350 if (isset($this->data
)) {
351 $json['data'] = $this->data
;
353 if (isset($this->url
)) {
354 $json['url'] = $this->url
;
356 if (isset($this->size
)) {
357 $json['size'] = $this->size
;
359 if (isset($this->hash
)) {
360 $json['hash'] = $this->hash
;
362 if (isset($this->title
)) {
363 $json['title'] = $this->title
;
365 if (isset($this->creation
)) {
366 $json['creation'] = $this->creation
;
372 * @param boolean $returnSXE
373 * @param \SimpleXMLElement $sxe
374 * @return string|\SimpleXMLElement
376 public function xmlSerialize($returnSXE = false, $sxe = null)
379 $sxe = new \
SimpleXMLElement('<Attachment xmlns="http://hl7.org/fhir"></Attachment>');
381 parent
::xmlSerialize(true, $sxe);
382 if (isset($this->contentType
)) {
383 $this->contentType
->xmlSerialize(true, $sxe->addChild('contentType'));
385 if (isset($this->language
)) {
386 $this->language
->xmlSerialize(true, $sxe->addChild('language'));
388 if (isset($this->data
)) {
389 $this->data
->xmlSerialize(true, $sxe->addChild('data'));
391 if (isset($this->url
)) {
392 $this->url
->xmlSerialize(true, $sxe->addChild('url'));
394 if (isset($this->size
)) {
395 $this->size
->xmlSerialize(true, $sxe->addChild('size'));
397 if (isset($this->hash
)) {
398 $this->hash
->xmlSerialize(true, $sxe->addChild('hash'));
400 if (isset($this->title
)) {
401 $this->title
->xmlSerialize(true, $sxe->addChild('title'));
403 if (isset($this->creation
)) {
404 $this->creation
->xmlSerialize(true, $sxe->addChild('creation'));
409 return $sxe->saveXML();