Issues (58)

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/DataContainer/Entity.php (1 issue)

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
 * @link    https://github.com/nnx-framework/jms-serializer-module
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\JmsSerializerModule\DataContainer;
7
8
use Doctrine\Common\Inflector\Inflector;
9
10
/**
11
 * Class Entity
12
 *
13
 * @package Nnx\JmsSerializerModule\DataContainer
14
 */
15
class Entity implements EntityInterface
16
{
17
    /**
18
     * Внутренний идендификатор контейнера с данынми для фикстуры
19
     *
20
     * @var integer
21
     */
22
    protected $id;
23
24
    /**
25
     * Поле используемое для генерации id
26
     *
27
     * @var int
28
     */
29
    protected static $idGenerator = 0;
30
31
    /**
32
     * Уровень на котором расположенна сущность
33
     *
34
     * @var integer
35
     */
36
    protected $level;
37
38
    /**
39
     * Свойства сущности
40
     *
41
     * @var Property[]
42
     */
43
    protected $properties = [];
44
45
    /**
46
     * Связи с другими сущностями
47
     *
48
     * @var Association[]
49
     */
50
    protected $associations = [];
51
52
    /**
53
     * Родительская сущность
54
     *
55
     * @var EntityInterface|null
56
     */
57
    protected $parentEntity;
58
59
    /**
60
     * Возвращает уровень, на котором расположена сущность
61
     *
62
     * @return int
63
     */
64
    public function getLevel()
65
    {
66
        return $this->level;
67
    }
68
69
    /**
70
     * Устанавливает уровень на котором расположена сущность
71
     *
72
     * @param int $level
73
     *
74
     * @return $this
75
     */
76
    public function setLevel($level)
77
    {
78
        $this->level = $level;
79
80
        return $this;
81
    }
82
83
    /**
84
     * Возвращает родительскую сущность
85
     *
86
     * @return EntityInterface|null
87
     */
88
    public function getParentEntity()
89
    {
90
        return $this->parentEntity;
91
    }
92
93
    /**
94
     * Устанавливает родительскую сущность
95
     *
96
     * @param EntityInterface $parentEntity
97
     *
98
     * @return $this
99
     */
100
    public function setParentEntity(EntityInterface $parentEntity = null)
101
    {
102
        $this->parentEntity = $parentEntity;
103
104
        return $this;
105
    }
106
107
    /**
108
     * Добавляет связь на вложенную сущность
109
     *
110
     * @param Association $association
111
     *
112
     * @return $this
113
     */
114
    public function addAssociation(Association $association)
115
    {
116
        $this->associations[$association->getName()] = $association;
117
118
        return $this;
119
    }
120
121
    /**
122
     * Возвращает связи
123
     *
124
     * @return Association[]
125
     */
126
    public function getAssociations()
127
    {
128
        return $this->associations;
129
    }
130
131
    /**
132
     * Добавляет поле
133
     *
134
     * @param Property $property
135
     *
136
     * @return $this
137
     */
138
    public function addProperty(Property $property)
139
    {
140
        $normalizeName = Inflector::camelize($property->getName());
141
142
        $this->properties[$normalizeName] = $property;
143
144
        return $this;
145
    }
146
147
    /**
148
     * Возвращает набор полей сущности
149
     *
150
     * @return Property[]
151
     */
152
    public function getProperties()
153
    {
154
        return $this->properties;
155
    }
156
157
    /**
158
     * Определяет, есть ли связь, с заданным именем
159
     *
160
     * @param $name
161
     *
162
     * @return bool
163
     */
164
    public function hasAssociation($name)
165
    {
166
        return array_key_exists($name, $this->associations);
167
    }
168
169
170
    /**
171
     * Определяет, есть ли связь, с заданным именем
172
     *
173
     * @param $name
174
     *
175
     * @return Association
176
     * @throws \Nnx\JmsSerializerModule\DataContainer\Exception\InvalidArgumentException
177
     */
178
    public function getAssociation($name)
179
    {
180
        if (!array_key_exists($name, $this->associations)) {
181
            $errMsg = sprintf('Association %s not found', $name);
182
            throw new Exception\InvalidArgumentException($errMsg);
183
        }
184
185
        return $this->associations[$name];
186
    }
187
188
    /**
189
     * Возвращает внутренний идендификатор контейнера с данынми для фикстуры
190
     *
191
     * @return int
192
     */
193 View Code Duplication
    public function getId()
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...
194
    {
195
        if (null === $this->id) {
196
            static::$idGenerator += 1;
197
            $this->id = static::$idGenerator;
198
        }
199
        return $this->id;
200
    }
201
}
202