some fixes (#2481)
[openemr.git] / phpfhir / HL7 / FHIR / STU3 / src / FHIRResource / FHIRBundle / FHIRBundleLink.php
blob29cae31a8b76ecc65712e55574052fdded8cc22d
1 <?php namespace HL7\FHIR\STU3\FHIRResource\FHIRBundle;
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 * A container for a collection of resources.
15 class FHIRBundleLink extends FHIRBackboneElement implements \JsonSerializable
17 /**
18 * A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).
19 * @var \HL7\FHIR\STU3\FHIRElement\FHIRString
21 public $relation = null;
23 /**
24 * The reference details for the link.
25 * @var \HL7\FHIR\STU3\FHIRElement\FHIRUri
27 public $url = null;
29 /**
30 * @var string
32 private $_fhirElementName = 'Bundle.Link';
34 /**
35 * A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).
36 * @return \HL7\FHIR\STU3\FHIRElement\FHIRString
38 public function getRelation()
40 return $this->relation;
43 /**
44 * A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).
45 * @param \HL7\FHIR\STU3\FHIRElement\FHIRString $relation
46 * @return $this
48 public function setRelation($relation)
50 $this->relation = $relation;
51 return $this;
54 /**
55 * The reference details for the link.
56 * @return \HL7\FHIR\STU3\FHIRElement\FHIRUri
58 public function getUrl()
60 return $this->url;
63 /**
64 * The reference details for the link.
65 * @param \HL7\FHIR\STU3\FHIRElement\FHIRUri $url
66 * @return $this
68 public function setUrl($url)
70 $this->url = $url;
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['relation'])) {
89 $this->setRelation($data['relation']);
91 if (isset($data['url'])) {
92 $this->setUrl($data['url']);
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->relation)) {
115 $json['relation'] = $this->relation;
117 if (isset($this->url)) {
118 $json['url'] = $this->url;
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('<BundleLink xmlns="http://hl7.org/fhir"></BundleLink>');
133 parent::xmlSerialize(true, $sxe);
134 if (isset($this->relation)) {
135 $this->relation->xmlSerialize(true, $sxe->addChild('relation'));
137 if (isset($this->url)) {
138 $this->url->xmlSerialize(true, $sxe->addChild('url'));
140 if ($returnSXE) {
141 return $sxe;
143 return $sxe->saveXML();