Issues (164)

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.

src/JhFlexiTime/Entity/Booking.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
namespace JhFlexiTime\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use ZfcUser\Entity\UserInterface;
7
use JhFlexiTime\DateTime\DateTime;
8
use JsonSerializable;
9
10
/**
11
 * Class Booking
12
 * @package JhFlexiTime\Entity
13
 * @author Ben Lill <[email protected]>
14
 *
15
 * @ORM\Entity
16
 * @ORM\Table(name="booking")
17
 */
18
class Booking implements JsonSerializable
19
{
20
21
    /**
22
     * @ORM\Id
23
     * @ORM\ManyToOne(targetEntity="JhUser\Entity\User")
24
     */
25
    protected $user = null;
26
27
    /**
28
     * @var DateTime
29
     *
30
     * @ORM\Id
31
     * @ORM\Column(type="date", name="date", nullable=false)
32
     */
33
    protected $date;
34
35
    /**
36
     * @var DateTime
37
     *
38
     * @ORM\Column(type="time", name="start_time", nullable=false)
39
     */
40
    protected $startTime;
41
42
    /**
43
     * @var DateTime
44
     *
45
     * @ORM\Column(type="time", name="end_time", nullable=false)
46
     */
47
    protected $endTime;
48
49
    /**
50
     * @var int
51
     *
52
     * @ORM\Column(type="string", length=255, nullable=false)
53
     */
54
    protected $total = 0;
55
56
    /**
57
     * @var int
58
     *
59
     * @ORM\Column(type="string", length=255, nullable=false)
60
     */
61
    protected $balance = 0;
62
63
    /** @var string
64
     *
65
     * @ORM\Column(type="string", length=512, nullable=true)
66
     */
67
    protected $notes = null;
68
69
    /**
70
     * Set Defaults
71
     */
72
    public function __construct()
73
    {
74
        $this->date         = new DateTime("today");
75
        $this->startTime    = new DateTime('09:00:00');
76
        $this->endTime      = new DateTime('17:30:00');
77
    }
78
79
    /**
80
     * @return string
81
     */
82
    public function getId()
83
    {
84
        if (!$this->user) {
85
            throw new \RuntimeException("No User is set. Needed to generate ID");
86
        }
87
88
        return $this->date->format('U') . "-" . $this->user->getId();
89
    }
90
91
    /**
92
     *
93
     * @param \ZfcUser\Entity\UserInterface $user
94
     * @return \JhFlexiTime\Entity\Booking
95
     */
96
    public function setUser(UserInterface $user)
97
    {
98
        $this->user = $user;
99
        return $this;
100
    }
101
102
    /**
103
     * @return \ZfcUser\Entity\UserInterface
104
     */
105
    public function getUser()
106
    {
107
        return $this->user;
108
    }
109
110
    /**
111
     * @param DateTime $date
112
     * @return \JhFlexiTime\Entity\Booking
113
     */
114
    public function setDate(DateTime $date)
115
    {
116
        $this->date = $date;
117
        return $this;
118
    }
119
120
    /**
121
     * @return DateTime
122
     */
123
    public function getDate()
124
    {
125
        return $this->date;
126
    }
127
128
    /**
129
     * @param DateTime $startTime
130
     * @return \JhFlexiTime\Entity\Booking
131
     */
132
    public function setStartTime(DateTime $startTime)
133
    {
134
        $this->startTime = $startTime;
135
        return $this;
136
    }
137
138
    /**
139
     * @return DateTime
140
     */
141
    public function getStartTime()
142
    {
143
        return $this->startTime;
144
    }
145
146
    /**
147
     * @param DateTime $endTime
148
     * @return \JhFlexiTime\Entity\Booking
149
     */
150
    public function setEndTime(DateTime $endTime)
151
    {
152
        $this->endTime = $endTime;
153
        return $this;
154
    }
155
156
    /**
157
     * @return DateTime
158
     */
159
    public function getEndTime()
160
    {
161
        return $this->endTime;
162
    }
163
164
    /**
165
     * @param string $total
166
     * @return \JhFlexiTime\Entity\Booking
167
     */
168
    public function setTotal($total)
169
    {
170
        $this->total = $total;
0 ignored issues
show
Documentation Bug introduced by
The property $total was declared of type integer, but $total is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
171
        return $this;
172
    }
173
174
    /**
175
     * @return string
176
     */
177
    public function getTotal()
178
    {
179
        return $this->total;
180
    }
181
182
    /**
183
     * @param int $balance
184
     * @return \JhFlexiTime\Entity\Booking
185
     */
186
    public function setBalance($balance)
187
    {
188
        $this->balance = $balance;
189
        return $this;
190
    }
191
192
    /**
193
     * @return int
194
     */
195
    public function getBalance()
196
    {
197
        return $this->balance;
198
    }
199
200
    /**
201
     * @param string $notes
202
     * @return \JhFlexiTime\Entity\Booking
203
     */
204
    public function setNotes($notes)
205
    {
206
        $this->notes = $notes;
207
        return $this;
208
    }
209
210
    /**
211
     * @return string
212
     */
213
    public function getNotes()
214
    {
215
        return $this->notes;
216
    }
217
218
    /**
219
     * @return array
220
     */
221
    public function jsonSerialize()
222
    {
223
        return [
224
            'id'        => $this->getId(),
225
            'user'      => $this->user->getId(),
226
            'date'      => $this->date->format('d-m-Y'),
227
            'startTime' => $this->startTime->format('H:i'),
228
            'endTime'   => $this->endTime->format('H:i'),
229
            'total'     => $this->total,
230
            'balance'   => $this->balance,
231
            'notes'     => $this->notes,
232
        ];
233
    }
234
}
235