Issues (3099)

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.

Kunstmaan/TranslatorBundle/Entity/Translation.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 Kunstmaan\TranslatorBundle\Entity;
4
5
use DateTime;
6
use Doctrine\ORM\Mapping as ORM;
7
use Kunstmaan\TranslatorBundle\Model\Translation as TranslationModel;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * @ORM\Entity(repositoryClass="Kunstmaan\TranslatorBundle\Repository\TranslationRepository")
12
 * @ORM\Table(
13
 *     name="kuma_translation",
14
 *     uniqueConstraints={
15
 *         @ORM\UniqueConstraint(name="keyword_per_locale", columns={"keyword", "locale", "domain"}),
16
 *         @ORM\UniqueConstraint(name="translation_id_per_locale", columns={"translation_id", "locale"}),
17
 *     },
18
 *     indexes={@ORM\Index(name="idx_translation_locale_domain", columns={"locale", "domain"})}
19
 * )
20
 * @ORM\HasLifecycleCallbacks
21
 */
22
class Translation
23
{
24
    const FLAG_NEW = 'new';
25
    const FLAG_UPDATED = 'updated';
26
    const STATUS_DEPRECATED = 'deprecated';
27
    const STATUS_DISABLED = 'disabled';
28
    const STATUS_ENABLED = 'enabled';
29
30
    /**
31
     * @ORM\Id
32
     * @ORM\Column(type="integer")
33
     * @ORM\GeneratedValue(strategy="AUTO")
34
     */
35
    protected $id;
36
37
    /**
38
     * @ORM\Column(type="integer", name="translation_id", nullable=true)
39
     * @Assert\NotBlank()
40
     */
41
    protected $translationId;
42
43
    /**
44
     * The translations keyword to use in your template or call from the translator
45
     *
46
     * @ORM\Column(type="string", nullable=true)
47
     * @Assert\NotBlank()
48
     */
49
    protected $keyword;
50
51
    /**
52
     * The translations keyword to use in your template or call from the translator
53
     *
54
     * @ORM\Column(type="string", length=5, nullable=true)
55
     * @Assert\NotBlank()
56
     */
57
    protected $locale;
58
59
    /**
60
     * @var string
61
     *             The translations deprecation date
62
     *
63
     * @ORM\column(type="string", length=10, options={"default" : "enabled"})
64
     */
65
    protected $status = self::STATUS_ENABLED;
66
67
    /**
68
     * Location where the translation comes from
69
     *
70
     * @ORM\Column(type="string", length=50, nullable=true)
71
     */
72
    protected $file;
73
74
    /**
75
     * Translation
76
     *
77
     * @var string
78
     * @ORM\Column(type="text", nullable=true)
79
     * @Assert\NotBlank()
80
     */
81
    protected $text;
82
83
    /**
84
     * @ORM\Column(type="string", length=30, nullable=true)
85
     * @Assert\NotBlank()
86
     */
87
    protected $domain;
88
89
    /**
90
     * @var \DateTime
91
     *
92
     * @ORM\Column(type="datetime", name="created_at", nullable=true)
93
     */
94
    protected $createdAt;
95
96
    /**
97
     * @var \DateTime
98
     *
99
     * @ORM\Column(type="datetime", name="updated_at", nullable=true)
100
     */
101
    protected $updatedAt;
102
103
    /**
104
     * A flag which defines the status of a specific translations ('updated', 'new', ..)
105
     *
106
     * @var string
107
     *
108
     * @ORM\Column(type="string", length=20, nullable=true)
109
     */
110
    protected $flag;
111
112
    /**
113
     * @ORM\PrePersist
114
     */
115 12 View Code Duplication
    public function prePersist()
116
    {
117 12
        $this->createdAt = new DateTime();
118 12
        $this->updatedAt = new DateTime();
119 12
        $this->flag = self::FLAG_NEW;
120
121 12
        return $this->id;
122
    }
123
124
    /**
125
     * @ORM\PreUpdate
126
     */
127 4 View Code Duplication
    public function preUpdate()
128
    {
129 4
        $this->updatedAt = new DateTime();
130
131 4
        if ($this->flag === null) {
132 3
            $this->flag = self::FLAG_UPDATED;
133
        }
134 4
    }
135
136
    /**
137
     * @return string
138
     */
139 1
    public function getId()
140
    {
141 1
        return $this->id;
142
    }
143
144
    /**
145
     * @param string $id
146
     *
147
     * @return Translation
148
     */
149 3
    public function setId($id)
150
    {
151 3
        $this->id = $id;
152
153 3
        return $this;
154
    }
155
156
    /**
157
     * @return string
158
     */
159 6
    public function getKeyword()
160
    {
161 6
        return $this->keyword;
162
    }
163
164
    /**
165
     * @param string $keyword
166
     *
167
     * @return Translation
168
     */
169 16
    public function setKeyword($keyword)
170
    {
171 16
        $this->keyword = $keyword;
172
173 16
        return $this;
174
    }
175
176
    /**
177
     * @return string
178
     */
179 5
    public function getLocale()
180
    {
181 5
        return $this->locale;
182
    }
183
184
    /**
185
     * @param string $locale
186
     *
187
     * @return Translation
188
     */
189 14
    public function setLocale($locale)
190
    {
191 14
        $this->locale = $locale;
192
193 14
        return $this;
194
    }
195
196
    /**
197
     * @return string
198
     */
199 1
    public function getFile()
200
    {
201 1
        return $this->file;
202
    }
203
204
    /**
205
     * @param string $file
206
     *
207
     * @return Translation
208
     */
209 6
    public function setFile($file)
210
    {
211 6
        $this->file = $file;
212
213 6
        return $this;
214
    }
215
216
    /**
217
     * @return string
218
     */
219 4
    public function getText()
220
    {
221 4
        return $this->text;
222
    }
223
224
    /**
225
     * @param string $text
226
     *
227
     * @return Translation
228
     */
229 16
    public function setText($text)
230
    {
231 16
        $this->text = $text;
232
233 16
        return $this;
234
    }
235
236
    /**
237
     * @return string
238
     */
239 6
    public function getDomain()
240
    {
241 6
        return $this->domain;
242
    }
243
244
    /**
245
     * @param string $domain
246
     *
247
     * @return Translation
248
     */
249 17
    public function setDomain($domain)
250
    {
251 17
        $this->domain = $domain;
252
253 17
        return $this;
254
    }
255
256
    /**
257
     * @return \DateTime
258
     */
259 1
    public function getCreatedAt()
260
    {
261 1
        return $this->createdAt;
262
    }
263
264
    /**
265
     * @param \DateTime $createdAt
266
     *
267
     * @return Translation
268
     */
269 15
    public function setCreatedAt(DateTime $createdAt)
270
    {
271 15
        $this->createdAt = $createdAt;
272
273 15
        return $this;
274
    }
275
276
    /**
277
     * @return \DateTime
278
     */
279 1
    public function getUpdatedAt()
280
    {
281 1
        return $this->updatedAt;
282
    }
283
284
    /**
285
     * @param DateTime $updatedAt
286
     *
287
     * @return Translation
288
     */
289 15
    public function setUpdatedAt(DateTime $updatedAt)
290
    {
291 15
        $this->updatedAt = $updatedAt;
292
293 15
        return $this;
294
    }
295
296
    /**
297
     * @return string
298
     */
299 1
    public function getFlag()
300
    {
301 1
        return $this->flag;
302
    }
303
304
    /**
305
     * @param string $flag
306
     *
307
     * @return Translation
308
     */
309 13
    public function setFlag($flag)
310
    {
311 13
        $this->flag = $flag;
312
313 13
        return $this;
314
    }
315
316
    /**
317
     * @param string $translationId
318
     *
319
     * @return Translation
320
     */
321 3
    public function setTranslationId($translationId)
322
    {
323 3
        $this->translationId = $translationId;
324
325 3
        return $this;
326
    }
327
328
    /**
329
     * @return string
330
     */
331 3
    public function getTranslationId()
332
    {
333 3
        return $this->translationId;
334
    }
335
336
    /**
337
     * @return string
338
     */
339 1
    public function getStatus()
340
    {
341 1
        return $this->status;
342
    }
343
344
    /**
345
     * @param string $status
346
     *
347
     * @return Translation
348
     */
349 13
    public function setStatus($status)
350
    {
351 13
        $this->status = $status;
352
353 13
        return $this;
354
    }
355
356
    /**
357
     * @return bool
358
     */
359 1
    public function isDisabled()
360
    {
361 1
        return $this->getStatus() === self::STATUS_DISABLED;
362
    }
363
364
    /**
365
     * @return bool
366
     */
367 1
    public function isDeprecated()
368
    {
369 1
        return $this->getStatus() === self::STATUS_DEPRECATED;
370
    }
371
372
    /**
373
     * @param int $id
0 ignored issues
show
Should the type for parameter $id not be integer|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
374
     *
375
     * @return TranslationModel
376
     */
377 1
    public function getTranslationModel($id = null)
378
    {
379 1
        $translationModel = new TranslationModel();
380 1
        $translationModel->setKeyword($this->getKeyword());
381 1
        $translationModel->setDomain($this->getDomain());
382 1
        $translationModel->addText($this->getLocale(), $this->getText(), $id);
383
384 1
        return $translationModel;
385
    }
386
}
387