Issues (115)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

lib/RIM/Act/Act.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
 * The MIT License
4
 *
5
 * Copyright 2017 Julien Fastré <[email protected]>.
6
 *
7
 * Permission is hereby granted, free of charge, to any person obtaining a copy
8
 * of this software and associated documentation files (the "Software"), to deal
9
 * in the Software without restriction, including without limitation the rights
10
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
 * copies of the Software, and to permit persons to whom the Software is
12
 * furnished to do so, subject to the following conditions:
13
 *
14
 * The above copyright notice and this permission notice shall be included in
15
 * all copies or substantial portions of the Software.
16
 *
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
 * THE SOFTWARE.
24
 */
25
namespace PHPHealth\CDA\RIM\Act;
26
27
use PHPHealth\CDA\Elements\AbstractElement;
28
use PHPHealth\CDA\HasClassCode;
29
use PHPHealth\CDA\HasMoodCodeInterface;
30
use PHPHealth\CDA\DataType\Collection\Set;
31
use PHPHealth\CDA\DataType\Code\CodedWithEquivalents;
32
use PHPHealth\CDA\DataType\Boolean\Boolean;
33
use PHPHealth\CDA\DataType\TextAndMultimedia\EncapsuledData;
34
use PHPHealth\CDA\DataType\Code\StatusCode;
35
use PHPHealth\CDA\DataType\Identifier\InstanceIdentifier;
36
use PHPHealth\CDA\Elements\Code;
37
use PHPHealth\CDA\DataType\Code\CodedValue;
38
39
/**
40
 * A record of something that is being done, has been done, can be done, 
41
 * or is intended or requested to be done.
42
 *
43
 * @author Julien Fastré <[email protected]>
44
 */
45
class Act extends AbstractElement implements HasClassCode, HasMoodCodeInterface
46
{
47
    /**
48
     * A unique identifier for the Act.
49
     *
50
     * @var Set
51
     */
52
    protected $ids;
53
    
54
    /**
55
     *
56
     * @var CodedValue
57
     */
58
    protected $code;
59
    
60
    /**
61
     *
62
     * @var Boolean
63
     */
64
    protected $negationInd;
65
    
66
    /**
67
     *
68
     * @var EncapsuledData
69
     */
70
    protected $text;
71
    
72
    /**
73
     *
74
     * @var StatusCode
75
     */
76
    protected $statusCode;
77
    
78
    protected $effectiveTime = array();
79
    
80
    /**
81
     *
82
     * @var array 
83
     */
84
    protected $templateIds;
85
    
86
    protected $moodCode = 'EVN';
87
    
88
    
89
    public function getIds()
90
    {
91
        return $this->ids;
92
    }
93
94
    public function getCode()
95
    {
96
        return $this->code;
97
    }
98
99
    public function getNegationInd(): Boolean
100
    {
101
        return $this->negationInd;
102
    }
103
104
    public function getText()
105
    {
106
        return $this->text;
107
    }
108
109
    public function getStatusCode()
110
    {
111
        return $this->statusCode;
112
    }
113
114
    public function getEffectiveTime()
115
    {
116
        return $this->effectiveTime;
117
    }
118
    
119
    public function getTemplateIds()
120
    {
121
        return $this->templateIds;
122
    }
123
124
    
125
    public function setIds(Set $ids)
126
    {
127
        $this->ids = $ids;
128
        return $this;
129
    }
130
131
    public function setCode(CodedValue $code)
132
    {
133
        $this->code = $code;
134
        
135
        return $this;
136
    }
137
138
    public function setNegationInd(Boolean $negationInd)
139
    {
140
        $this->negationInd = $negationInd;
141
        return $this;
142
    }
143
144
    public function setText(EncapsuledData $text)
145
    {
146
        $this->text = $text;
147
        return $this;
148
    }
149
150
    public function setStatusCode(StatusCode $statusCode)
151
    {
152
        $this->statusCode = $statusCode;
153
        return $this;
154
    }
155
156
    public function setEffectiveTime($effectiveTime, $append = true)
157
    {
158
        if ($append) {
159
            $this->effectiveTime[] = $effectiveTime;
160
        } else {
161
            $this->effectiveTime = array($effectiveTime);
162
        }
163
        
164
        return $this;
165
    }
166
167
    /**
168
     * 
169
     * @param InstanceIdentifier[] $templateIds
170
     * @return $this
171
     */
172 View Code Duplication
    public function setTemplateIds(array $templateIds)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
173
    {
174
        // check that each element is an instance of InstanceIdentifier
175
        $result = \array_reduce($templateIds, function ($carry, $current) {
176
            if ($carry === false) {
177
                return false;
178
            }
179
            
180
            return $current instanceof InstanceIdentifier;
181
        });
182
        
183
        if ($result === false) {
184
            throw new \RuntimeException(sprintf("the templateIds must be "
185
                . "instance of %s", InstanceIdentifier::class));
186
        }
187
        
188
        $this->templateIds = $templateIds;
189
        
190
        
191
        return $this;
192
    }
193
194
    public function addTemplateId(InstanceIdentifier $id)
195
    {
196
        $this->templateIds[] = $id;
197
        
198
        return $this;
199
    }
200
            
201
    public function getClassCode(): string
202
    {
203
        return 'ACT';
204
    }
205
    
206
    public function getMoodCode()
207
    {
208
        return $this->moodCode;
209
    }
210
211
    protected function getElementTag(): string
212
    {
213
        return 'act';
214
    }
215
216
    public function toDOMElement(\DOMDocument $doc): \DOMElement
217
    {
218
        $el = $this->createElement($doc);
219
        
220 View Code Duplication
        if ($this->getTemplateIds() !== null) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
221
            foreach ($this->templateIds as $id) {
222
                $el->appendChild((new TemplateId($id))->toDOMElement($doc));
223
            }
224
        }
225
        
226
        if ($this->getText() !== null) {
227
            $el->appendChild((new Text($this->getText()))->toDOMElement($doc));
228
        }
229
        
230
        if ($this->getCode() !== null) {
231
            $el->appendChild((new Code($this->getCode()))->toDOMElement($doc));
232
        }
233
        
234
        return $el;
235
    }
236
237
}
238