ConceptDescriptor::setCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
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\Code;
28
29
use PHPHealth\CDA\ClinicalDocument as CDA;
30
31
/**
32
 * A CD represents any kind of concept usually by giving a code defined in a
33
 * code system. A CD can contain the original text or phrase that served as the
34
 * basis of the coding and one or more translations into different coding systems.
35
 * A CD can also contain qualifiers to describe, e.g., the concept of a
36
 * "left foot" as a postcoordinated term built from the primary code "FOOT"
37
 * and the qualifier "LEFT". In cases of an exceptional value, the CD need
38
 * not contain a code but only the original text describing that concept.
39
 *
40
 *
41
 * @author Julien Fastré <[email protected]>
42
 */
43
class ConceptDescriptor extends \PHPHealth\CDA\DataType\AnyType
44
{
45
    
46
    private $qualifier;
0 ignored issues
show
Unused Code introduced by
The property $qualifier is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
47
        
48
    private $translation;
0 ignored issues
show
Unused Code introduced by
The property $translation is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
49
    
50
    private $codeSystem;
51
    
52
    private $codeSystemName;
53
    
54
    private $displayName;
55
    
56
    private $originalText;
57
    
58
    /**
59
     *
60
     * @var string
61
     */
62
    private $code;
63
    
64
    public function getCode()
65
    {
66
        return $this->code;
67
    }
68
69
    public function setCode($code)
70
    {
71
        $this->code = $code;
72
        
73
        return $this;
74
    }
75
    
76
    public function getCodeSystem()
77
    {
78
        return $this->codeSystem;
79
    }
80
    
81
    public function hasCodeSystem()
82
    {
83
        return !empty($this->getCodeSystem());
84
    }
85
86
    public function getCodeSystemName()
87
    {
88
        return $this->codeSystemName;
89
    }
90
    
91
    public function hasCodeSystemName()
92
    {
93
        return !empty($this->getCodeSystemName());
94
    }
95
96
    public function getDisplayName()
97
    {
98
        return $this->displayName;
99
    }
100
    
101
    public function hasDisplayName()
102
    {
103
        return !empty($this->getDisplayName());
104
    }
105
106
    public function getOriginalText()
107
    {
108
        return $this->originalText;
109
    }
110
    
111
    public function hasOriginalText()
112
    {
113
        return !empty($this->getOriginalText());
114
    }
115
116
    public function setCodeSystem($codeSystem)
117
    {
118
        $this->codeSystem = $codeSystem;
119
        return $this;
120
    }
121
122
    public function setCodeSystemName($codeSystemName)
123
    {
124
        $this->codeSystemName = $codeSystemName;
125
        return $this;
126
    }
127
128
    public function setDisplayName($displayName)
129
    {
130
        $this->displayName = $displayName;
131
        return $this;
132
    }
133
134
    public function setOriginalText($originalText)
135
    {
136
        $this->originalText = $originalText;
137
        return $this;
138
    }
139
140
    public function setValueToElement(\DOMElement &$el, \DOMDocument $doc = null)
141
    {
142
        $el->setAttribute(CDA::NS_CDA."code", $this->getCode());
143
        
144
        if ($this->hasDisplayName()) {
145
            $el->setAttribute("displayName", $this->getDisplayName());
146
        }
147
        
148
        if ($this->hasCodeSystem()) {
149
            $el->setAttribute("codeSystem", $this->getCodeSystem());
150
        }
151
        
152
        if ($this->hasCodeSystemName()) {
153
            $el->setAttribute("codeSystemName", $this->getCodeSystemName());
154
        }
155
    }
156
}
157