Issues (9)

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.

src/Definition.php (2 issues)

Labels
Severity

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
/*
4
 * This file is part of the xAPI package.
5
 *
6
 * (c) Christian Flothmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Xabbuh\XApi\Model;
13
14
/**
15
 * Definition of an {@link Activity}.
16
 *
17
 * A number of derived classes exists each of them covering a specialized
18
 * type of user interaction:
19
 *
20
 * <ul>
21
 *   <li>ChoiceInteractionDefinition</li>
22
 *   <li>FillInteractionDefinition</li>
23
 *   <li>LikertInteractionDefinition</li>
24
 *   <li>LongFillInInteractionDefinition</li>
25
 *   <li>MatchingInteractionDefinition</li>
26
 *   <li>NumericInteractionDefinition</li>
27
 *   <li>PerformanceInteractionDefinition</li>
28
 *   <li>OtherInteractionDefinition</li>
29
 *   <li>SequencingInteractionDefinition</li>
30
 *   <li>TrueFalseInteractionDefinition</li>
31
 * </ul>
32
 *
33
 * @author Christian Flothmann <[email protected]>
34
 */
35
class Definition
36
{
37
    private $name;
38
    private $description;
39
    private $type;
40
    private $moreInfo;
41
    private $extensions;
42
43
    public function __construct(LanguageMap $name = null, LanguageMap $description = null, IRI $type = null, IRL $moreInfo = null, Extensions $extensions = null)
44
    {
45
        $this->name = $name;
46
        $this->description = $description;
47
        $this->type = $type;
48
        $this->moreInfo = $moreInfo;
49
        $this->extensions = $extensions;
50
    }
51
52
    public function withName(LanguageMap $name = null): self
53
    {
54
        $definition = clone $this;
55
        $definition->name = $name;
56
57
        return $definition;
58
    }
59
60
    public function withDescription(LanguageMap $description = null): self
61
    {
62
        $definition = clone $this;
63
        $definition->description = $description;
64
65
        return $definition;
66
    }
67
68
    public function withType(IRI $type = null): self
69
    {
70
        $definition = clone $this;
71
        $definition->type = $type;
72
73
        return $definition;
74
    }
75
76
    public function withMoreInfo(IRL $moreInfo = null): self
77
    {
78
        $definition = clone $this;
79
        $definition->moreInfo = $moreInfo;
80
81
        return $definition;
82
    }
83
84
    public function withExtensions(Extensions $extensions): self
85
    {
86
        $definition = clone $this;
87
        $definition->extensions = $extensions;
88
89
        return $definition;
90
    }
91
92
    /**
93
     * Returns the human readable names.
94
     */
95
    public function getName(): ?LanguageMap
96
    {
97
        return $this->name;
98
    }
99
100
    /**
101
     * Returns the human readable descriptions.
102
     */
103
    public function getDescription(): ?LanguageMap
104
    {
105
        return $this->description;
106
    }
107
108
    /**
109
     * Returns the {@link Activity} type.
110
     */
111
    public function getType(): ?IRI
112
    {
113
        return $this->type;
114
    }
115
116
    /**
117
     * Returns an IRL where human-readable information about the activity can be found.
118
     */
119
    public function getMoreInfo(): ?IRL
120
    {
121
        return $this->moreInfo;
122
    }
123
124
    public function getExtensions(): ?Extensions
125
    {
126
        return $this->extensions;
127
    }
128
129
    /**
130
     * Checks if another definition is equal.
131
     *
132
     * Two definitions are equal if and only if all of their properties are equal.
133
     */
134
    public function equals(Definition $definition): bool
135
    {
136
        if (get_class($this) !== get_class($definition)) {
137
            return false;
138
        }
139
140
        if (null !== $this->type xor null !== $definition->type) {
141
            return false;
142
        }
143
144
        if (null !== $this->type && null !== $definition->type && !$this->type->equals($definition->type)) {
145
            return false;
146
        }
147
148
        if (null !== $this->moreInfo xor null !== $definition->moreInfo) {
149
            return false;
150
        }
151
152
        if (null !== $this->moreInfo && null !== $definition->moreInfo && !$this->moreInfo->equals($definition->moreInfo)) {
153
            return false;
154
        }
155
156
        if (null !== $this->extensions xor null !== $definition->extensions) {
157
            return false;
158
        }
159
160
        if (null !== $this->name xor null !== $definition->name) {
161
            return false;
162
        }
163
164
        if (null !== $this->description xor null !== $definition->description) {
165
            return false;
166
        }
167
168
        if (null !== $this->name) {
169
            if (count($this->name) !== count($definition->name)) {
170
                return false;
171
            }
172
173
            foreach ($this->name as $language => $value) {
0 ignored issues
show
The expression $this->name of type object<Xabbuh\XApi\Model\LanguageMap> is not traversable.
Loading history...
174
                if (!isset($definition->name[$language])) {
175
                    return false;
176
                }
177
178
                if ($value !== $definition->name[$language]) {
179
                    return false;
180
                }
181
            }
182
        }
183
184
        if (null !== $this->description) {
185
            if (count($this->description) !== count($definition->description)) {
186
                return false;
187
            }
188
189
            foreach ($this->description as $language => $value) {
0 ignored issues
show
The expression $this->description of type object<Xabbuh\XApi\Model\LanguageMap> is not traversable.
Loading history...
190
                if (!isset($definition->description[$language])) {
191
                    return false;
192
                }
193
194
                if ($value !== $definition->description[$language]) {
195
                    return false;
196
                }
197
            }
198
        }
199
200
        if (null !== $this->extensions && null !== $definition->extensions && !$this->extensions->equals($definition->extensions)) {
201
            return false;
202
        }
203
204
        return true;
205
    }
206
}
207