fixes: mostly php 8.3 fixes to prepare for next release (#6935)
[openemr.git] / src / FHIR / R4 / FHIRDomainResource / FHIRSpecimen.php
blob5f10e1571199c974a000d42c8f2808c4f4c3cd1d
1 <?php
3 namespace OpenEMR\FHIR\R4\FHIRDomainResource;
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\FHIRResource\FHIRDomainResource;
67 /**
68 * A sample to be used for analysis.
69 * If the element is present, it must have either a @value, an @id, or extensions
71 class FHIRSpecimen extends FHIRDomainResource implements \JsonSerializable
73 /**
74 * Id for specimen.
75 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRIdentifier[]
77 public $identifier = [];
79 /**
80 * The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.
81 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRIdentifier
83 public $accessionIdentifier = null;
85 /**
86 * The availability of the specimen.
87 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRSpecimenStatus
89 public $status = null;
91 /**
92 * The kind of material that forms the specimen.
93 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept
95 public $type = null;
97 /**
98 * Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device.
99 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRReference
101 public $subject = null;
104 * Time when specimen was received for processing or testing.
105 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRDateTime
107 public $receivedTime = null;
110 * Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.
111 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRReference[]
113 public $parent = [];
116 * Details concerning a service request that required a specimen to be collected.
117 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRReference[]
119 public $request = [];
122 * Details concerning the specimen collection.
123 * @var \OpenEMR\FHIR\R4\FHIRResource\FHIRSpecimen\FHIRSpecimenCollection
125 public $collection = null;
128 * Details concerning processing and processing steps for the specimen.
129 * @var \OpenEMR\FHIR\R4\FHIRResource\FHIRSpecimen\FHIRSpecimenProcessing[]
131 public $processing = [];
134 * The container holding the specimen. The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.
135 * @var \OpenEMR\FHIR\R4\FHIRResource\FHIRSpecimen\FHIRSpecimenContainer[]
137 public $container = [];
140 * A mode or state of being that describes the nature of the specimen.
141 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept[]
143 public $condition = [];
146 * To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).
147 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRAnnotation[]
149 public $note = [];
152 * @var string
154 private $_fhirElementName = 'Specimen';
157 * Id for specimen.
158 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRIdentifier[]
160 public function getIdentifier()
162 return $this->identifier;
166 * Id for specimen.
167 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRIdentifier $identifier
168 * @return $this
170 public function addIdentifier($identifier)
172 $this->identifier[] = $identifier;
173 return $this;
177 * The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.
178 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRIdentifier
180 public function getAccessionIdentifier()
182 return $this->accessionIdentifier;
186 * The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.
187 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRIdentifier $accessionIdentifier
188 * @return $this
190 public function setAccessionIdentifier($accessionIdentifier)
192 $this->accessionIdentifier = $accessionIdentifier;
193 return $this;
197 * The availability of the specimen.
198 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRSpecimenStatus
200 public function getStatus()
202 return $this->status;
206 * The availability of the specimen.
207 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRSpecimenStatus $status
208 * @return $this
210 public function setStatus($status)
212 $this->status = $status;
213 return $this;
217 * The kind of material that forms the specimen.
218 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept
220 public function getType()
222 return $this->type;
226 * The kind of material that forms the specimen.
227 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept $type
228 * @return $this
230 public function setType($type)
232 $this->type = $type;
233 return $this;
237 * Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device.
238 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRReference
240 public function getSubject()
242 return $this->subject;
246 * Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device.
247 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRReference $subject
248 * @return $this
250 public function setSubject($subject)
252 $this->subject = $subject;
253 return $this;
257 * Time when specimen was received for processing or testing.
258 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRDateTime
260 public function getReceivedTime()
262 return $this->receivedTime;
266 * Time when specimen was received for processing or testing.
267 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRDateTime $receivedTime
268 * @return $this
270 public function setReceivedTime($receivedTime)
272 $this->receivedTime = $receivedTime;
273 return $this;
277 * Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.
278 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRReference[]
280 public function getParent()
282 return $this->parent;
286 * Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.
287 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRReference $parent
288 * @return $this
290 public function addParent($parent)
292 $this->parent[] = $parent;
293 return $this;
297 * Details concerning a service request that required a specimen to be collected.
298 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRReference[]
300 public function getRequest()
302 return $this->request;
306 * Details concerning a service request that required a specimen to be collected.
307 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRReference $request
308 * @return $this
310 public function addRequest($request)
312 $this->request[] = $request;
313 return $this;
317 * Details concerning the specimen collection.
318 * @return \OpenEMR\FHIR\R4\FHIRResource\FHIRSpecimen\FHIRSpecimenCollection
320 public function getCollection()
322 return $this->collection;
326 * Details concerning the specimen collection.
327 * @param \OpenEMR\FHIR\R4\FHIRResource\FHIRSpecimen\FHIRSpecimenCollection $collection
328 * @return $this
330 public function setCollection($collection)
332 $this->collection = $collection;
333 return $this;
337 * Details concerning processing and processing steps for the specimen.
338 * @return \OpenEMR\FHIR\R4\FHIRResource\FHIRSpecimen\FHIRSpecimenProcessing[]
340 public function getProcessing()
342 return $this->processing;
346 * Details concerning processing and processing steps for the specimen.
347 * @param \OpenEMR\FHIR\R4\FHIRResource\FHIRSpecimen\FHIRSpecimenProcessing $processing
348 * @return $this
350 public function addProcessing($processing)
352 $this->processing[] = $processing;
353 return $this;
357 * The container holding the specimen. The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.
358 * @return \OpenEMR\FHIR\R4\FHIRResource\FHIRSpecimen\FHIRSpecimenContainer[]
360 public function getContainer()
362 return $this->container;
366 * The container holding the specimen. The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.
367 * @param \OpenEMR\FHIR\R4\FHIRResource\FHIRSpecimen\FHIRSpecimenContainer $container
368 * @return $this
370 public function addContainer($container)
372 $this->container[] = $container;
373 return $this;
377 * A mode or state of being that describes the nature of the specimen.
378 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept[]
380 public function getCondition()
382 return $this->condition;
386 * A mode or state of being that describes the nature of the specimen.
387 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept $condition
388 * @return $this
390 public function addCondition($condition)
392 $this->condition[] = $condition;
393 return $this;
397 * To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).
398 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRAnnotation[]
400 public function getNote()
402 return $this->note;
406 * To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).
407 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRAnnotation $note
408 * @return $this
410 public function addNote($note)
412 $this->note[] = $note;
413 return $this;
417 * @return string
419 public function get_fhirElementName()
421 return $this->_fhirElementName;
425 * @param mixed $data
427 public function __construct($data = [])
429 if (is_array($data)) {
430 if (isset($data['identifier'])) {
431 if (is_array($data['identifier'])) {
432 foreach ($data['identifier'] as $d) {
433 $this->addIdentifier($d);
435 } else {
436 throw new \InvalidArgumentException('"identifier" must be array of objects or null, ' . gettype($data['identifier']) . ' seen.');
439 if (isset($data['accessionIdentifier'])) {
440 $this->setAccessionIdentifier($data['accessionIdentifier']);
442 if (isset($data['status'])) {
443 $this->setStatus($data['status']);
445 if (isset($data['type'])) {
446 $this->setType($data['type']);
448 if (isset($data['subject'])) {
449 $this->setSubject($data['subject']);
451 if (isset($data['receivedTime'])) {
452 $this->setReceivedTime($data['receivedTime']);
454 if (isset($data['parent'])) {
455 if (is_array($data['parent'])) {
456 foreach ($data['parent'] as $d) {
457 $this->addParent($d);
459 } else {
460 throw new \InvalidArgumentException('"parent" must be array of objects or null, ' . gettype($data['parent']) . ' seen.');
463 if (isset($data['request'])) {
464 if (is_array($data['request'])) {
465 foreach ($data['request'] as $d) {
466 $this->addRequest($d);
468 } else {
469 throw new \InvalidArgumentException('"request" must be array of objects or null, ' . gettype($data['request']) . ' seen.');
472 if (isset($data['collection'])) {
473 $this->setCollection($data['collection']);
475 if (isset($data['processing'])) {
476 if (is_array($data['processing'])) {
477 foreach ($data['processing'] as $d) {
478 $this->addProcessing($d);
480 } else {
481 throw new \InvalidArgumentException('"processing" must be array of objects or null, ' . gettype($data['processing']) . ' seen.');
484 if (isset($data['container'])) {
485 if (is_array($data['container'])) {
486 foreach ($data['container'] as $d) {
487 $this->addContainer($d);
489 } else {
490 throw new \InvalidArgumentException('"container" must be array of objects or null, ' . gettype($data['container']) . ' seen.');
493 if (isset($data['condition'])) {
494 if (is_array($data['condition'])) {
495 foreach ($data['condition'] as $d) {
496 $this->addCondition($d);
498 } else {
499 throw new \InvalidArgumentException('"condition" must be array of objects or null, ' . gettype($data['condition']) . ' seen.');
502 if (isset($data['note'])) {
503 if (is_array($data['note'])) {
504 foreach ($data['note'] as $d) {
505 $this->addNote($d);
507 } else {
508 throw new \InvalidArgumentException('"note" must be array of objects or null, ' . gettype($data['note']) . ' seen.');
511 } elseif (null !== $data) {
512 throw new \InvalidArgumentException('$data expected to be array of values, saw "' . gettype($data) . '"');
514 parent::__construct($data);
518 * @return string
520 public function __toString()
522 return $this->get_fhirElementName();
526 * @return array
528 public function jsonSerialize(): mixed
530 $json = parent::jsonSerialize();
531 $json['resourceType'] = $this->_fhirElementName;
532 if (0 < count($this->identifier)) {
533 $json['identifier'] = [];
534 foreach ($this->identifier as $identifier) {
535 $json['identifier'][] = $identifier;
538 if (isset($this->accessionIdentifier)) {
539 $json['accessionIdentifier'] = $this->accessionIdentifier;
541 if (isset($this->status)) {
542 $json['status'] = $this->status;
544 if (isset($this->type)) {
545 $json['type'] = $this->type;
547 if (isset($this->subject)) {
548 $json['subject'] = $this->subject;
550 if (isset($this->receivedTime)) {
551 $json['receivedTime'] = $this->receivedTime;
553 if (0 < count($this->parent)) {
554 $json['parent'] = [];
555 foreach ($this->parent as $parent) {
556 $json['parent'][] = $parent;
559 if (0 < count($this->request)) {
560 $json['request'] = [];
561 foreach ($this->request as $request) {
562 $json['request'][] = $request;
565 if (isset($this->collection)) {
566 $json['collection'] = $this->collection;
568 if (0 < count($this->processing)) {
569 $json['processing'] = [];
570 foreach ($this->processing as $processing) {
571 $json['processing'][] = $processing;
574 if (0 < count($this->container)) {
575 $json['container'] = [];
576 foreach ($this->container as $container) {
577 $json['container'][] = $container;
580 if (0 < count($this->condition)) {
581 $json['condition'] = [];
582 foreach ($this->condition as $condition) {
583 $json['condition'][] = $condition;
586 if (0 < count($this->note)) {
587 $json['note'] = [];
588 foreach ($this->note as $note) {
589 $json['note'][] = $note;
592 return $json;
596 * @param boolean $returnSXE
597 * @param \SimpleXMLElement $sxe
598 * @return string|\SimpleXMLElement
600 public function xmlSerialize($returnSXE = false, $sxe = null)
602 if (null === $sxe) {
603 $sxe = new \SimpleXMLElement('<Specimen xmlns="http://hl7.org/fhir"></Specimen>');
605 parent::xmlSerialize(true, $sxe);
606 if (0 < count($this->identifier)) {
607 foreach ($this->identifier as $identifier) {
608 $identifier->xmlSerialize(true, $sxe->addChild('identifier'));
611 if (isset($this->accessionIdentifier)) {
612 $this->accessionIdentifier->xmlSerialize(true, $sxe->addChild('accessionIdentifier'));
614 if (isset($this->status)) {
615 $this->status->xmlSerialize(true, $sxe->addChild('status'));
617 if (isset($this->type)) {
618 $this->type->xmlSerialize(true, $sxe->addChild('type'));
620 if (isset($this->subject)) {
621 $this->subject->xmlSerialize(true, $sxe->addChild('subject'));
623 if (isset($this->receivedTime)) {
624 $this->receivedTime->xmlSerialize(true, $sxe->addChild('receivedTime'));
626 if (0 < count($this->parent)) {
627 foreach ($this->parent as $parent) {
628 $parent->xmlSerialize(true, $sxe->addChild('parent'));
631 if (0 < count($this->request)) {
632 foreach ($this->request as $request) {
633 $request->xmlSerialize(true, $sxe->addChild('request'));
636 if (isset($this->collection)) {
637 $this->collection->xmlSerialize(true, $sxe->addChild('collection'));
639 if (0 < count($this->processing)) {
640 foreach ($this->processing as $processing) {
641 $processing->xmlSerialize(true, $sxe->addChild('processing'));
644 if (0 < count($this->container)) {
645 foreach ($this->container as $container) {
646 $container->xmlSerialize(true, $sxe->addChild('container'));
649 if (0 < count($this->condition)) {
650 foreach ($this->condition as $condition) {
651 $condition->xmlSerialize(true, $sxe->addChild('condition'));
654 if (0 < count($this->note)) {
655 foreach ($this->note as $note) {
656 $note->xmlSerialize(true, $sxe->addChild('note'));
659 if ($returnSXE) {
660 return $sxe;
662 return $sxe->saveXML();