EncapsuledData::setCompression()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 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 NONINFRINGEMENT. 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 PHPHealth\CDA\DataType\TextAndMultimedia;
28
29
use PHPHealth\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
    public function getMediaType()
61
    {
62
        return $this->mediaType;
63
    }
64
65
    public function getCharset()
66
    {
67
        return $this->charset;
68
    }
69
70
    public function getLanguage()
71
    {
72
        return $this->language;
73
    }
74
75
    public function getCompression()
76
    {
77
        return $this->compression;
78
    }
79
80
    public function getReference()
81
    {
82
        return $this->reference;
83
    }
84
85
    public function getIntegrityCheck()
86
    {
87
        return $this->integrityCheck;
88
    }
89
90
    public function getIntetgrityCheckAlgorithm()
91
    {
92
        return $this->intetgrityCheckAlgorithm;
93
    }
94
95
    public function getThumbnail()
96
    {
97
        return $this->thumbnail;
98
    }
99
100
    public function setMediaType($mediaType)
101
    {
102
        $this->mediaType = $mediaType;
103
        return $this;
104
    }
105
106
    public function setCharset($charset)
107
    {
108
        $this->charset = $charset;
109
        return $this;
110
    }
111
112
    public function setLanguage($language)
113
    {
114
        $this->language = $language;
115
        return $this;
116
    }
117
118
    public function setCompression($compression)
119
    {
120
        $this->compression = $compression;
121
        return $this;
122
    }
123
124
    public function setReference($reference)
125
    {
126
        $this->reference = $reference;
127
        return $this;
128
    }
129
130
    public function setIntegrityCheck($integrityCheck)
131
    {
132
        $this->integrityCheck = $integrityCheck;
133
        return $this;
134
    }
135
136
    public function setIntetgrityCheckAlgorithm($intetgrityCheckAlgorithm)
137
    {
138
        $this->intetgrityCheckAlgorithm = $intetgrityCheckAlgorithm;
139
        return $this;
140
    }
141
142
    public function setThumbnail($thumbnail)
143
    {
144
        $this->thumbnail = $thumbnail;
145
        return $this;
146
    }
147
148
    public function setValueToElement(\DOMElement &$el, \DOMDocument $doc = null)
149
    {
150
        if ($this->getMediaType() !== 'text/plain') {
151
            $el->setAttribute(CD::NS_CDA.'mediaType', $this->getMediaType());
152
        }
153
    
154
        if ($this->getMediaType() == 'text/plain') {
155
            $content = new \DOMCdataSection($this->getContent());
156
        } else {
157
            $content = new \DOMText($this->getContent());
158
        }
159
        
160
        $el->appendChild($content);
161
    }
162
}
163