EncapsuledData   A
last analyzed

Complexity

Total Complexity 20

Size/Duplication

Total Lines 186
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 20
eloc 39
dl 0
loc 186
rs 10
c 0
b 0
f 0

17 Methods

Rating   Name   Duplication   Size   Complexity  
A getReference() 0 3 1
A setCompression() 0 4 1
A getCharset() 0 3 1
A setIntegrityCheckAlgorithm() 0 4 1
A getIntegrityCheck() 0 3 1
A getThumbnail() 0 3 1
A setLanguage() 0 4 1
A getIntegrityCheckAlgorithm() 0 3 1
A getCompression() 0 3 1
A setCharset() 0 4 1
A getLanguage() 0 3 1
A setReference() 0 4 1
A setIntegrityCheck() 0 4 1
A setThumbnail() 0 4 1
A setMediaType() 0 4 1
A setValueToElement() 0 12 4
A getMediaType() 0 3 1
1
<?php
2
3
/**
4
 * The MIT License
5
 *
6
 * Copyright 2016 Julien Fastré <[email protected]>.
7
 *
8
 * Permission is hereby granted, free of charge, to any person obtaining a copy
9
 * of this software and associated documentation files (the "Software"), to deal
10
 * in the Software without restriction, including without limitation the rights
11
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
 * copies of the Software, and to permit persons to whom the Software is
13
 * furnished to do so, subject to the following conditions:
14
 *
15
 * The above copyright notice and this permission notice shall be included in
16
 * all copies or substantial portions of the Software.
17
 *
18
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
 * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
21
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
 * THE SOFTWARE.
25
 */
26
27
namespace i3Soft\CDA\DataType\TextAndMultimedia;
28
29
use i3Soft\CDA\ClinicalDocument as CD;
30
31
/**
32
 * Data that is primarily intended for human interpretation or for further
33
 * machine processing outside the scope of HL7. This includes unformatted or
34
 * formatted written language, multimedia data, or structured information in as
35
 * defined by a different standard (e.g., XML-signatures.) Instead of the data
36
 * itself, an ED may contain only a reference (see TEL.) Note that ST is a
37
 * specialization of the ED where the mediaType is fixed to text/plain.
38
 *
39
 *
40
 * @author Julien Fastré <[email protected]>
41
 */
42
class EncapsuledData extends BinaryData
43
{
44
  private $mediaType;
45
46
  private $charset;
47
48
  private $language;
49
50
  private $compression;
51
52
  private $reference;
53
54
  private $integrityCheck;
55
56
  private $intetgrityCheckAlgorithm;
57
58
  private $thumbnail;
59
60
  /**
61
   * @return mixed
62
   */
63
  public function getCharset ()
64
  {
65
    return $this->charset;
66
  }
67
68
  /**
69
   * @param $charset
70
   *
71
   * @return self
72
   */
73
  public function setCharset ($charset): self
74
  {
75
    $this->charset = $charset;
76
    return $this;
77
  }
78
79
  /**
80
   * @return mixed
81
   */
82
  public function getLanguage ()
83
  {
84
    return $this->language;
85
  }
86
87
  /**
88
   * @param $language
89
   *
90
   * @return self
91
   */
92
  public function setLanguage ($language): self
93
  {
94
    $this->language = $language;
95
    return $this;
96
  }
97
98
  /**
99
   * @return mixed
100
   */
101
  public function getCompression ()
102
  {
103
    return $this->compression;
104
  }
105
106
  /**
107
   * @param $compression
108
   *
109
   * @return self
110
   */
111
  public function setCompression ($compression): self
112
  {
113
    $this->compression = $compression;
114
    return $this;
115
  }
116
117
  /**
118
   * @return mixed
119
   */
120
  public function getReference ()
121
  {
122
    return $this->reference;
123
  }
124
125
  /**
126
   * @param $reference
127
   *
128
   * @return self
129
   */
130
  public function setReference ($reference): self
131
  {
132
    $this->reference = $reference;
133
    return $this;
134
  }
135
136
  /**
137
   * @return mixed
138
   */
139
  public function getIntegrityCheck ()
140
  {
141
    return $this->integrityCheck;
142
  }
143
144
  /**
145
   * @param $integrityCheck
146
   *
147
   * @return self
148
   */
149
  public function setIntegrityCheck ($integrityCheck): self
150
  {
151
    $this->integrityCheck = $integrityCheck;
152
    return $this;
153
  }
154
155
  /**
156
   * @return mixed
157
   */
158
  public function getIntegrityCheckAlgorithm ()
159
  {
160
    return $this->intetgrityCheckAlgorithm;
161
  }
162
163
  /**
164
   * @param $integrityCheckAlgorithm
165
   *
166
   * @return self
167
   */
168
  public function setIntegrityCheckAlgorithm ($integrityCheckAlgorithm): self
169
  {
170
    $this->intetgrityCheckAlgorithm = $integrityCheckAlgorithm;
171
    return $this;
172
  }
173
174
  /**
175
   * @return mixed
176
   */
177
  public function getThumbnail ()
178
  {
179
    return $this->thumbnail;
180
  }
181
182
  /**
183
   * @param $thumbnail
184
   *
185
   * @return self
186
   */
187
  public function setThumbnail ($thumbnail): self
188
  {
189
    $this->thumbnail = $thumbnail;
190
    return $this;
191
  }
192
193
  /**
194
   * @param \DOMElement       $el
195
   * @param \DOMDocument|NULL $doc
196
   */
197
  public function setValueToElement (\DOMElement $el, \DOMDocument $doc)
198
  {
199
    if ($this->getMediaType() && $this->getMediaType() !== 'text/plain')
200
    {
201
      $el->setAttribute(CD::getNS() . 'mediaType', $this->getMediaType());
202
    }
203
204
    $content = $this->getMediaType() === 'text/plain'
205
      ? new \DOMCdataSection($this->getContent())
206
      : new \DOMText($this->getContent());
207
208
    $el->appendChild($content);
209
  }
210
211
  /**
212
   * @return mixed
213
   */
214
  public function getMediaType ()
215
  {
216
    return $this->mediaType;
217
  }
218
219
  /**
220
   * @param $mediaType
221
   *
222
   * @return self
223
   */
224
  public function setMediaType ($mediaType): self
225
  {
226
    $this->mediaType = $mediaType;
227
    return $this;
228
  }
229
230
231
}
232