fixes: mostly php 8.3 fixes to prepare for next release (#6935)
[openemr.git] / src / FHIR / R4 / FHIRResource / FHIRContract / FHIRContractSigner.php
blobf0840bb6d2244399221097bf8dfac51a390ca0b4
1 <?php
3 namespace OpenEMR\FHIR\R4\FHIRResource\FHIRContract;
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\FHIRBackboneElement;
67 /**
68 * Legally enforceable, formally recorded unilateral or bilateral directive i.e., a policy or agreement.
70 class FHIRContractSigner extends FHIRBackboneElement implements \JsonSerializable
72 /**
73 * Role of this Contract signer, e.g. notary, grantee.
74 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding
76 public $type = null;
78 /**
79 * Party which is a signator to this Contract.
80 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRReference
82 public $party = null;
84 /**
85 * Legally binding Contract DSIG signature contents in Base64.
86 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRSignature[]
88 public $signature = [];
90 /**
91 * @var string
93 private $_fhirElementName = 'Contract.Signer';
95 /**
96 * Role of this Contract signer, e.g. notary, grantee.
97 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding
99 public function getType()
101 return $this->type;
105 * Role of this Contract signer, e.g. notary, grantee.
106 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding $type
107 * @return $this
109 public function setType($type)
111 $this->type = $type;
112 return $this;
116 * Party which is a signator to this Contract.
117 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRReference
119 public function getParty()
121 return $this->party;
125 * Party which is a signator to this Contract.
126 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRReference $party
127 * @return $this
129 public function setParty($party)
131 $this->party = $party;
132 return $this;
136 * Legally binding Contract DSIG signature contents in Base64.
137 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRSignature[]
139 public function getSignature()
141 return $this->signature;
145 * Legally binding Contract DSIG signature contents in Base64.
146 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRSignature $signature
147 * @return $this
149 public function addSignature($signature)
151 $this->signature[] = $signature;
152 return $this;
156 * @return string
158 public function get_fhirElementName()
160 return $this->_fhirElementName;
164 * @param mixed $data
166 public function __construct($data = [])
168 if (is_array($data)) {
169 if (isset($data['type'])) {
170 $this->setType($data['type']);
172 if (isset($data['party'])) {
173 $this->setParty($data['party']);
175 if (isset($data['signature'])) {
176 if (is_array($data['signature'])) {
177 foreach ($data['signature'] as $d) {
178 $this->addSignature($d);
180 } else {
181 throw new \InvalidArgumentException('"signature" must be array of objects or null, ' . gettype($data['signature']) . ' seen.');
184 } elseif (null !== $data) {
185 throw new \InvalidArgumentException('$data expected to be array of values, saw "' . gettype($data) . '"');
187 parent::__construct($data);
191 * @return string
193 public function __toString()
195 return $this->get_fhirElementName();
199 * @return array
201 public function jsonSerialize(): mixed
203 $json = parent::jsonSerialize();
204 if (isset($this->type)) {
205 $json['type'] = $this->type;
207 if (isset($this->party)) {
208 $json['party'] = $this->party;
210 if (0 < count($this->signature)) {
211 $json['signature'] = [];
212 foreach ($this->signature as $signature) {
213 $json['signature'][] = $signature;
216 return $json;
220 * @param boolean $returnSXE
221 * @param \SimpleXMLElement $sxe
222 * @return string|\SimpleXMLElement
224 public function xmlSerialize($returnSXE = false, $sxe = null)
226 if (null === $sxe) {
227 $sxe = new \SimpleXMLElement('<ContractSigner xmlns="http://hl7.org/fhir"></ContractSigner>');
229 parent::xmlSerialize(true, $sxe);
230 if (isset($this->type)) {
231 $this->type->xmlSerialize(true, $sxe->addChild('type'));
233 if (isset($this->party)) {
234 $this->party->xmlSerialize(true, $sxe->addChild('party'));
236 if (0 < count($this->signature)) {
237 foreach ($this->signature as $signature) {
238 $signature->xmlSerialize(true, $sxe->addChild('signature'));
241 if ($returnSXE) {
242 return $sxe;
244 return $sxe->saveXML();