1 <?php
namespace HL7\FHIR\STU3
;
4 * This class was generated with the PHPFHIR library (https://github.com/dcarbone/php-fhir) using
5 * class definitions from HL7 FHIR (https://www.hl7.org/fhir/)
7 * Class creation date: February 10th, 2018
12 * This is the base resource type for everything.
14 class FHIRResource
implements \JsonSerializable
17 * The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.
18 * @var \HL7\FHIR\STU3\FHIRElement\FHIRId
23 * The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.
24 * @var \HL7\FHIR\STU3\FHIRElement\FHIRMeta
29 * A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.
30 * @var \HL7\FHIR\STU3\FHIRElement\FHIRUri
32 public $implicitRules = null;
35 * The base language in which the resource is written.
36 * @var \HL7\FHIR\STU3\FHIRElement\FHIRCode
38 public $language = null;
43 private $_fhirElementName = 'Resource';
46 * The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.
47 * @return \HL7\FHIR\STU3\FHIRElement\FHIRId
49 public function getId()
55 * The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.
56 * @param \HL7\FHIR\STU3\FHIRElement\FHIRId $id
59 public function setId($id)
66 * The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.
67 * @return \HL7\FHIR\STU3\FHIRElement\FHIRMeta
69 public function getMeta()
75 * The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.
76 * @param \HL7\FHIR\STU3\FHIRElement\FHIRMeta $meta
79 public function setMeta($meta)
86 * A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.
87 * @return \HL7\FHIR\STU3\FHIRElement\FHIRUri
89 public function getImplicitRules()
91 return $this->implicitRules
;
95 * A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.
96 * @param \HL7\FHIR\STU3\FHIRElement\FHIRUri $implicitRules
99 public function setImplicitRules($implicitRules)
101 $this->implicitRules
= $implicitRules;
106 * The base language in which the resource is written.
107 * @return \HL7\FHIR\STU3\FHIRElement\FHIRCode
109 public function getLanguage()
111 return $this->language
;
115 * The base language in which the resource is written.
116 * @param \HL7\FHIR\STU3\FHIRElement\FHIRCode $language
119 public function setLanguage($language)
121 $this->language
= $language;
128 public function get_fhirElementName()
130 return $this->_fhirElementName
;
136 public function __construct($data = [])
138 if (is_array($data)) {
139 if (isset($data['id'])) {
140 $this->setId($data['id']);
142 if (isset($data['meta'])) {
143 $this->setMeta($data['meta']);
145 if (isset($data['implicitRules'])) {
146 $this->setImplicitRules($data['implicitRules']);
148 if (isset($data['language'])) {
149 $this->setLanguage($data['language']);
151 } else if (null !== $data) {
152 throw new \
InvalidArgumentException('$data expected to be array of values, saw "'.gettype($data).'"');
159 public function __toString()
161 return (string)$this->getId();
167 public function jsonSerialize()
170 if (isset($this->id
)) {
171 $json['id'] = $this->id
;
173 if (isset($this->meta
)) {
174 $json['meta'] = $this->meta
;
176 if (isset($this->implicitRules
)) {
177 $json['implicitRules'] = $this->implicitRules
;
179 if (isset($this->language
)) {
180 $json['language'] = $this->language
;
186 * @param boolean $returnSXE
187 * @param \SimpleXMLElement $sxe
188 * @return string|\SimpleXMLElement
190 public function xmlSerialize($returnSXE = false, $sxe = null)
193 $sxe = new \
SimpleXMLElement('<Resource xmlns="http://hl7.org/fhir"></Resource>');
195 if (isset($this->id
)) {
196 $this->id
->xmlSerialize(true, $sxe->addChild('id'));
198 if (isset($this->meta
)) {
199 $this->meta
->xmlSerialize(true, $sxe->addChild('meta'));
201 if (isset($this->implicitRules
)) {
202 $this->implicitRules
->xmlSerialize(true, $sxe->addChild('implicitRules'));
204 if (isset($this->language
)) {
205 $this->language
->xmlSerialize(true, $sxe->addChild('language'));
210 return $sxe->saveXML();