Phase 1 FHIR on PHP- Provider Client and implement classes. (#1422)
[openemr.git] / phpfhir / HL7 / FHIR / STU3 / src / FHIRResource / FHIRPatient / FHIRPatientCommunication.php
blob85fea9996f51ff9c609556f96357dcc6c8e29773
1 <?php namespace HL7\FHIR\STU3\FHIRResource\FHIRPatient;
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 */
10 use HL7\FHIR\STU3\FHIRElement\FHIRBackboneElement;
12 /**
13 * Demographics and other administrative information about an individual or animal receiving care or other health-related services.
15 class FHIRPatientCommunication extends FHIRBackboneElement implements \JsonSerializable
17 /**
18 * The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.
19 * @var \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept
21 public $language = null;
23 /**
24 * Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).
25 * @var \HL7\FHIR\STU3\FHIRElement\FHIRBoolean
27 public $preferred = null;
29 /**
30 * @var string
32 private $_fhirElementName = 'Patient.Communication';
34 /**
35 * The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.
36 * @return \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept
38 public function getLanguage()
40 return $this->language;
43 /**
44 * The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.
45 * @param \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept $language
46 * @return $this
48 public function setLanguage($language)
50 $this->language = $language;
51 return $this;
54 /**
55 * Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).
56 * @return \HL7\FHIR\STU3\FHIRElement\FHIRBoolean
58 public function getPreferred()
60 return $this->preferred;
63 /**
64 * Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).
65 * @param \HL7\FHIR\STU3\FHIRElement\FHIRBoolean $preferred
66 * @return $this
68 public function setPreferred($preferred)
70 $this->preferred = $preferred;
71 return $this;
74 /**
75 * @return string
77 public function get_fhirElementName()
79 return $this->_fhirElementName;
82 /**
83 * @param mixed $data
85 public function __construct($data = [])
87 if (is_array($data)) {
88 if (isset($data['language'])) {
89 $this->setLanguage($data['language']);
91 if (isset($data['preferred'])) {
92 $this->setPreferred($data['preferred']);
94 } else if (null !== $data) {
95 throw new \InvalidArgumentException('$data expected to be array of values, saw "'.gettype($data).'"');
97 parent::__construct($data);
101 * @return string
103 public function __toString()
105 return $this->get_fhirElementName();
109 * @return array
111 public function jsonSerialize()
113 $json = parent::jsonSerialize();
114 if (isset($this->language)) {
115 $json['language'] = $this->language;
117 if (isset($this->preferred)) {
118 $json['preferred'] = $this->preferred;
120 return $json;
124 * @param boolean $returnSXE
125 * @param \SimpleXMLElement $sxe
126 * @return string|\SimpleXMLElement
128 public function xmlSerialize($returnSXE = false, $sxe = null)
130 if (null === $sxe) {
131 $sxe = new \SimpleXMLElement('<PatientCommunication xmlns="http://hl7.org/fhir"></PatientCommunication>');
133 parent::xmlSerialize(true, $sxe);
134 if (isset($this->language)) {
135 $this->language->xmlSerialize(true, $sxe->addChild('language'));
137 if (isset($this->preferred)) {
138 $this->preferred->xmlSerialize(true, $sxe->addChild('preferred'));
140 if ($returnSXE) {
141 return $sxe;
143 return $sxe->saveXML();