Phase 1 FHIR on PHP- Provider Client and implement classes. (#1422)
[openemr.git] / phpfhir / HL7 / FHIR / STU3 / src / FHIRResource.php
blobf7b9ce695a49d215d95f03bc0caa7ac34fb500b5
1 <?php namespace HL7\FHIR\STU3;
3 /*!
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/)
6 *
7 * Class creation date: February 10th, 2018
8 *
9 */
11 /**
12 * This is the base resource type for everything.
14 class FHIRResource implements \JsonSerializable
16 /**
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
20 public $id = null;
22 /**
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
26 public $meta = null;
28 /**
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;
34 /**
35 * The base language in which the resource is written.
36 * @var \HL7\FHIR\STU3\FHIRElement\FHIRCode
38 public $language = null;
40 /**
41 * @var string
43 private $_fhirElementName = 'Resource';
45 /**
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()
51 return $this->id;
54 /**
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
57 * @return $this
59 public function setId($id)
61 $this->id = $id;
62 return $this;
65 /**
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()
71 return $this->meta;
74 /**
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
77 * @return $this
79 public function setMeta($meta)
81 $this->meta = $meta;
82 return $this;
85 /**
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;
94 /**
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
97 * @return $this
99 public function setImplicitRules($implicitRules)
101 $this->implicitRules = $implicitRules;
102 return $this;
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
117 * @return $this
119 public function setLanguage($language)
121 $this->language = $language;
122 return $this;
126 * @return string
128 public function get_fhirElementName()
130 return $this->_fhirElementName;
134 * @param mixed $data
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).'"');
157 * @return string
159 public function __toString()
161 return (string)$this->getId();
165 * @return array
167 public function jsonSerialize()
169 $json = [];
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;
182 return $json;
186 * @param boolean $returnSXE
187 * @param \SimpleXMLElement $sxe
188 * @return string|\SimpleXMLElement
190 public function xmlSerialize($returnSXE = false, $sxe = null)
192 if (null === $sxe) {
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'));
207 if ($returnSXE) {
208 return $sxe;
210 return $sxe->saveXML();