Issues (1704)

Branch: master

Security Analysis    not enabled

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.

BusinessEntityBundle/Entity/BusinessEntity.php (7 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
namespace Victoire\Bundle\BusinessEntityBundle\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
8
/**
9
 * The business Entity.
10
 *
11
 * @ORM\Entity(repositoryClass="Victoire\Bundle\BusinessEntityBundle\Entity\BusinessEntityRepository")
12
 * @ORM\Table("vic_business_entity")
13
 * @ORM\InheritanceType("SINGLE_TABLE")
14
 * @ORM\DiscriminatorColumn(name="type", type="string")
15
 */
16
abstract class BusinessEntity
0 ignored issues
show
Abstract class name is not prefixed with "Abstract"
Loading history...
17
{
18
    /**
19
     * @var int
20
     *
21
     * @ORM\Column(name="id", type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="AUTO")
24
     */
25
    protected $id;
26
27
    /**
28
     * @var string
29
     *
30
     * @ORM\Column(name="name", type="string", length=255)
31
     */
32
    protected $name;
33
34
    /**
35
     * @var BusinessProperty[]
36
     *
37
     * @ORM\OneToMany(targetEntity="Victoire\Bundle\BusinessEntityBundle\Entity\BusinessProperty", mappedBy="businessEntity", cascade={"persist", "remove"})
38
     */
39
    protected $businessProperties;
40
41
    /**
42
     * @var array
43
     *
44
     * @ORM\Column(name="availableWidgets", type="text")
45
     */
46
    protected $availableWidgets;
47
48
    protected $disable = false;
49
50
    public function __construct()
0 ignored issues
show
Missing function doc comment
Loading history...
51
    {
52
        $this->businessProperties = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type array<integer,object<Vic...tity\BusinessProperty>> of property $businessProperties.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
53
    }
54
55
    /**
56
     * Get the id.
57
     *
58
     * @return int The id
59
     */
60
    public function getId()
61
    {
62
        return $this->id;
63
    }
64
65
    /**
66
     * Get the name.
67
     *
68
     * @return string The name
69
     */
70
    public function getName()
71
    {
72
        return $this->name;
73
    }
74
75
    /**
76
     * Set the name.
77
     *
78
     * @param string $name
79
     */
80
    public function setName($name)
81
    {
82
        $this->name = $name;
83
    }
84
85
    /**
86
     * Add a business property.
87
     *
88
     * @param BusinessProperty $businessProperty
89
     */
90
    public function addBusinessProperty(BusinessProperty $businessProperty)
91
    {
92
        $this->businessProperties->add($businessProperty);
93
    }
94
95
    /**
96
     * Get the business properties.
97
     *
98
     * @return BusinessProperty[] The business properties
99
     */
100
    public function getBusinessProperties()
101
    {
102
        return $this->businessProperties;
103
    }
104
105
    /**
0 ignored issues
show
Doc comment for parameter "$name" missing
Loading history...
106
     * Get a business property by name.
107
     *
108
     * @return BusinessProperty|null The business property
109
     */
110
    public function getBusinessPropertyByName($name)
111
    {
112
        foreach ($this->businessProperties as $businessProperty) {
113
            if ($businessProperty->getName() == $name) {
114
                return $businessProperty;
115
            }
116
        }
117
    }
118
119
    /**
0 ignored issues
show
Doc comment for parameter "$businessProperties" missing
Loading history...
120
     * Get the business properties.
121
     *
122
     * @return array The business properties
123
     */
124
    public function setBusinessProperties($businessProperties)
125
    {
126
        return $this->businessProperties = $businessProperties;
127
    }
128
129
    /**
130
     * Get the business properties by type.
131
     *
132
     * @param string $type
133
     *
134
     * @return ArrayCollection The businnes properties
135
     */
136
    public function getBusinessPropertiesByType($type)
137
    {
138
        if (!is_array($type)) {
139
            $type = [$type];
140
        }
141
        $bp = new ArrayCollection();
142
        foreach ($this->getBusinessProperties() as $property) {
143
            if (count(array_diff($type, $property->getTypes())) == 0) {
144
                $bp->add($property);
145
            }
146
        }
147
148
        return $bp;
149
    }
150
151
    /**
152
     * Get the business properties names by type.
153
     *
154
     *
155
     * @return ArrayCollection The businnes properties
156
     */
157
    public function getBusinessParameters()
158
    {
159
        $bp = new ArrayCollection();
160
        /** @var BusinessProperty $property */
161
        foreach ($this->getBusinessProperties() as $property) {
162
            if ($property->hasType('businessParameter')) {
163
                $bp->add($property);
164
            }
165
        }
166
167
        return $bp;
168
    }
169
170
    /**
171
     * Get the business identifiers.
172
     *
173
     *
174
     * @return ArrayCollection The businnes properties
175
     */
176
    public function getBusinessIdentifiers()
177
    {
178
        $bp = new ArrayCollection();
179
        /** @var BusinessProperty $property */
180
        foreach ($this->getBusinessProperties() as $property) {
181
            if ($property->hasType('businessIdentifier')) {
182
                $bp->add($property);
183
            }
184
        }
185
        if ($bp->count() < 1) {
186
            throw new \Exception(sprintf('The businessEntity %s must have at lease one businessIdentifier property', $this->name));
187
        }
188
189
        return $bp;
190
    }
191
192
    /**
193
     * @return array
194
     */
195
    public function getAvailableWidgets()
196
    {
197
        return unserialize($this->availableWidgets);
198
    }
199
200
    /**
201
     * @param array $availableWidgets
202
     */
203
    public function setAvailableWidgets($availableWidgets)
204
    {
205
        $this->availableWidgets = serialize($availableWidgets);
0 ignored issues
show
Documentation Bug introduced by
It seems like serialize($availableWidgets) of type string is incompatible with the declared type array of property $availableWidgets.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
206
    }
207
208
    /**
209
     * @return bool
210
     */
211
    public function isDisable()
212
    {
213
        return $this->disable;
214
    }
215
216
    /**
217
     * @param bool $disable
218
     */
219
    public function setDisable($disable)
220
    {
221
        $this->disable = $disable;
222
    }
223
224
    public function __toString()
0 ignored issues
show
Missing function doc comment
Loading history...
225
    {
226
        return $this->name;
227
    }
228
}
229