Issues (21)

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/Entity/Item.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 namespace BinPacking3d\Entity;
2
3
use BinPacking3d\Entity;
4
use BinPacking3d\EntityInterface;
5
use BinPacking3d\Utils;
6
7
/**
8
 * Class Item
9
 * @package BinPacking3d\Entity
10
 */
11
class Item implements EntityInterface
12
{
13
14
    /**
15
     * @var
16
     */
17
    private $width;
18
19
    /**
20
     * @var
21
     */
22
    private $height;
23
24
    /**
25
     * @var
26
     */
27
    private $depth;
28
29
    /**
30
     * @var int
31
     */
32
    private $quantity = 1;
33
34
    /**
35
     * @var bool
36
     */
37
    private $verticalRotationLock = false;
38
39
    /**
40
     * @var
41
     */
42
    private $itemIdentifier;
43
44
    /**
45
     * @var
46
     */
47
    private $weight;
48
49
    /**
50
     * @var
51
     */
52
    private $product;
53
54
    /**
55
     * @return array
56
     */
57
    public function render()
58
    {
59
        return [
60
            'w' => $this->getWidth(),
61
            'h' => $this->getHeight(),
62
            'd' => $this->getDepth(),
63
            'q' => $this->getQuantity(),
64
            'vr' => (int)$this->isVerticalRotationLock(),
65
            'id' => $this->getItemIdentifier(),
66
            'wg' => $this->getWeight(),
67
        ];
68
    }
69
70
    /**
71
     * @return mixed
72
     */
73
    public function getWidth()
74
    {
75
        return $this->width;
76
    }
77
78
    /**
79
     * @param mixed $width
80
     * @return Item
81
     */
82
    public function setWidth($width)
83
    {
84
        $this->width = (float)$width;
85
86
        return $this;
87
    }
88
89
    /**
90
     * @return mixed
91
     */
92
    public function getHeight()
93
    {
94
        return $this->height;
95
    }
96
97
    /**
98
     * @param mixed $height
99
     * @return Item
100
     */
101
    public function setHeight($height)
102
    {
103
        $this->height = (float)$height;
104
105
        return $this;
106
    }
107
108
    /**
109
     * @return mixed
110
     */
111
    public function getDepth()
112
    {
113
        return $this->depth;
114
    }
115
116
    /**
117
     * @param mixed $depth
118
     * @return Item
119
     */
120
    public function setDepth($depth)
121
    {
122
        $this->depth = (float)$depth;
123
124
        return $this;
125
    }
126
127
    /**
128
     * @return int
129
     */
130
    public function getQuantity()
131
    {
132
        return $this->quantity;
133
    }
134
135
    /**
136
     * @param int $quantity
137
     * @return Item
138
     */
139
    public function setQuantity($quantity)
140
    {
141
        $this->quantity = (int)$quantity;
142
143
        return $this;
144
    }
145
146
    /**
147
     * @return boolean
148
     */
149
    public function isVerticalRotationLock()
150
    {
151
        return $this->verticalRotationLock;
152
    }
153
154
    /**
155
     * @param boolean $verticalRotationLock
156
     * @return Item
157
     */
158
    public function setVerticalRotationLock($verticalRotationLock)
159
    {
160
        $this->verticalRotationLock = (bool)$verticalRotationLock;
161
162
        return $this;
163
    }
164
165
    /**
166
     * @return mixed
167
     */
168
    public function getItemIdentifier()
169
    {
170
        return $this->itemIdentifier;
171
    }
172
173
    /**
174
     * @param mixed $itemIdentifier
175
     * @return Item
176
     */
177
    public function setItemIdentifier($itemIdentifier)
178
    {
179
        $this->itemIdentifier = (string)$itemIdentifier;
180
181
        return $this;
182
    }
183
184
    /**
185
     * @return mixed
186
     */
187
    public function getWeight()
188
    {
189
        return $this->weight;
190
    }
191
192
    /**
193
     * @param mixed $weight
194
     * @return Item
195
     */
196
    public function setWeight($weight)
197
    {
198
        $this->weight = (float)$weight;
199
200
        return $this;
201
    }
202
203
    /**
204
     * @return bool
205
     */
206 View Code Duplication
    final public function validate()
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...
207
    {
208
        return Utils::noEmptyItems([
209
            $this->getWidth(),
210
            $this->getHeight(),
211
            $this->getDepth(),
212
            $this->getQuantity(),
213
            $this->getItemIdentifier(),
214
            $this->getWeight(),
215
        ]);
216
    }
217
218
    /**
219
     * @return mixed
220
     */
221
    public function getProduct()
222
    {
223
        return $this->product;
224
    }
225
226
    /**
227
     * @param mixed $product
228
     * @return Item
229
     */
230
    public function setProduct($product)
231
    {
232
        $this->product = $product;
233
234
        return $this;
235
    }
236
237
}
238