Issues (108)

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.

Entity/Subscription.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
/**
4
 * @author Rafał Muszyński <[email protected]>
5
 * @copyright 2013 Sourcefabric o.p.s.
6
 * @license http://www.gnu.org/licenses/gpl-3.0.txt
7
 */
8
namespace Newscoop\PaywallBundle\Entity;
9
10
use Doctrine\ORM\Mapping as ORM;
11
use Doctrine\Common\Collections\ArrayCollection;
12
use Newscoop\PaywallBundle\Validator\Constraints as PaywallValidators;
13
use Gedmo\Mapping\Annotation as Gedmo;
14
use Gedmo\Translatable\Translatable;
15
16
/**
17
 * Subscriptions entity.
18
 *
19
 * @ORM\Entity(repositoryClass="Newscoop\PaywallBundle\Entity\Repository\SubscriptionRepository")
20
 * @ORM\Table(name="plugin_paywall_subscriptions")
21
 * @Gedmo\TranslationEntity(class="SubscriptionTranslation")
22
 */
23
class Subscription implements Translatable, PriceableInterface
24
{
25
    /**
26
     * @ORM\Id()
27
     * @ORM\GeneratedValue(strategy="AUTO")
28
     * @ORM\Column(type="integer", name="id")
29
     *
30
     * @var int
31
     */
32
    protected $id;
33
34
    /**
35
     * @Gedmo\Translatable
36
     * @ORM\Column(type="string", name="name")
37
     *
38
     * @var string
39
     */
40
    protected $name;
41
42
    /**
43
     * @ORM\OneToMany(targetEntity="SubscriptionSpecification", mappedBy="subscription")
44
     *
45
     * @var array
46
     */
47
    protected $specification;
48
49
    /**
50
     * @ORM\Column(type="text", name="type")
51
     *
52
     * @var string
53
     */
54
    protected $type;
55
56
    /**
57
     * @ORM\OneToMany(targetEntity="Duration", mappedBy="subscription", cascade={"persist", "remove"})
58
     *
59
     * @var Doctrine\Common\Collections\ArrayCollection
60
     */
61
    protected $ranges;
62
63
    /**
64
     * @PaywallValidators\ContainsDecimal(entity="Subscription", property="price")
65
     * @ORM\Column(type="decimal", name="price", precision=10, scale=2)
66
     *
67
     * @var decimal
68
     */
69
    protected $price;
70
71
    /**
72
     * @ORM\Column(type="string", name="currency")
73
     *
74
     * @var string
75
     */
76
    protected $currency;
77
78
    /**
79
     * @Gedmo\Translatable
80
     * @ORM\Column(type="text", name="description", nullable=true)
81
     *
82
     * @var text
83
     */
84
    protected $description;
85
86
    /**
87
     * @ORM\Column(type="datetime", name="created_at")
88
     *
89
     * @var string
90
     */
91
    protected $created_at;
92
93
    /**
94
     * @ORM\Column(type="boolean", name="is_active")
95
     *
96
     * @var bool
97
     */
98
    protected $is_active;
99
100
    /**
101
     * @ORM\Column(type="boolean", name="is_default", nullable=true)
102
     *
103
     * @var bool
104
     */
105
    protected $is_default;
106
107
    /**
108
     * @ORM\OneToMany(
109
     *   targetEntity="SubscriptionTranslation",
110
     *   mappedBy="object",
111
     *   cascade={"persist", "remove"}
112
     * )
113
     */
114
    protected $translations;
115
116
    /**
117
     * @Gedmo\Locale
118
     * Used locale to override Translation listener`s locale
119
     * this is not a mapped field of entity metadata, just a simple property
120
     */
121
    public $locale;
122
123
    /**
124
     * @ORM\Column(type="boolean", name="is_template", nullable=true)
125
     *
126
     * @var bool
127
     */
128
    protected $isTemplate;
129
130
    public function __construct()
131
    {
132
        $this->specification = new ArrayCollection();
133
        $this->setCreatedAt(new \DateTime());
134
        $this->setIsActive(true);
135
        $this->ranges = new ArrayCollection();
136
        $this->translations = new ArrayCollection();
137
        $this->isTemplate = false;
138
    }
139
140
    /**
141
     * Get subscription id.
142
     *
143
     * @return int
144
     */
145
    public function getId()
146
    {
147
        return $this->id;
148
    }
149
150
    /**
151
     * Get subscription name.
152
     *
153
     * @return string
154
     */
155
    public function getName()
156
    {
157
        return $this->name;
158
    }
159
160
    /**
161
     * Set subscription name.
162
     *
163
     * @param string $name
164
     *
165
     * @return string
166
     */
167
    public function setName($name)
168
    {
169
        $this->name = $name;
170
171
        return $name;
172
    }
173
174
    /**
175
     * Get specification.
176
     *
177
     * @return array
178
     */
179
    public function getSpecification()
180
    {
181
        return $this->specification;
182
    }
183
184
    /**
185
     * Get subscription type.
186
     *
187
     * @return int
188
     */
189
    public function getType()
190
    {
191
        return $this->type;
192
    }
193
194
    /**
195
     * Set subscription type.
196
     *
197
     * @param int $type
198
     *
199
     * @return int
200
     */
201
    public function setType($type)
202
    {
203
        $this->type = $type;
0 ignored issues
show
Documentation Bug introduced by
The property $type was declared of type string, but $type is of type integer. 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...
204
205
        return $this;
206
    }
207
208
    /**
209
     * Get subscription price.
210
     *
211
     * @return decimal
212
     */
213
    public function getPrice()
214
    {
215
        return $this->price;
216
    }
217
218
    /**
219
     * Set subscription price.
220
     *
221
     * @param decimal $price
222
     *
223
     * @return decimal
224
     */
225
    public function setPrice($price)
226
    {
227
        $this->price = $price;
228
229
        return $this;
230
    }
231
232
    /**
233
     * Get subscription currency.
234
     *
235
     * @return string
236
     */
237
    public function getCurrency()
238
    {
239
        return $this->currency;
240
    }
241
242
    /**
243
     * Set subscription currency.
244
     *
245
     * @param string $currency
246
     *
247
     * @return string
248
     */
249
    public function setCurrency($currency)
250
    {
251
        $this->currency = $currency;
252
253
        return $this;
254
    }
255
256
    /**
257
     * Get subscription description.
258
     *
259
     * @return text
260
     */
261
    public function getDescription()
262
    {
263
        return $this->description;
264
    }
265
266
    /**
267
     * Set subscription description.
268
     *
269
     * @param text $description
270
     *
271
     * @return text
272
     */
273
    public function setDescription($description)
274
    {
275
        $this->description = $description;
276
277
        return $this;
278
    }
279
280
    /**
281
     * Get subscription status.
282
     *
283
     * @return bool
284
     */
285
    public function getIsActive()
286
    {
287
        return $this->is_active;
288
    }
289
290
    /**
291
     * Set subscription status.
292
     *
293
     * @param bool $is_active
294
     *
295
     * @return bool
296
     */
297
    public function setIsActive($is_active)
298
    {
299
        $this->is_active = $is_active;
300
301
        return $this;
302
    }
303
304
    /**
305
     * Get subscription create date.
306
     *
307
     * @return datetime
308
     */
309
    public function getCreatedAt()
310
    {
311
        return $this->created_at;
312
    }
313
314
    /**
315
     * Set subscription create date.
316
     *
317
     * @param datetime $created_at
318
     *
319
     * @return datetime
320
     */
321
    public function setCreatedAt(\DateTime $created_at)
322
    {
323
        $this->created_at = $created_at;
324
325
        return $this;
326
    }
327
328
    /**
329
     * Get default.
330
     *
331
     * @return bool
332
     */
333
    public function getIsDefault()
334
    {
335
        return $this->is_default;
336
    }
337
338
    /**
339
     * Set is_default.
340
     *
341
     * @param bool $is_default
342
     *
343
     * @return bool
344
     */
345
    public function setIsDefault($is_default)
346
    {
347
        $this->is_default = $is_default;
348
349
        return $this;
350
    }
351
352
    /**
353
     * Gets the value of ranges.
354
     *
355
     * @return Doctrine\Common\Collections\ArrayCollection
356
     */
357
    public function getRanges()
358
    {
359
        return $this->ranges;
360
    }
361
362
    /**
363
     * Sets the value of ranges.
364
     *
365
     * @param Doctrine\Common\Collections\ArrayCollection $ranges the ranges
366
     *
367
     * @return self
368
     */
369
    public function setRanges(\Doctrine\Common\Collections\ArrayCollection $ranges)
370
    {
371
        $this->ranges = $ranges;
372
373
        return $this;
374
    }
375
376
    /**
377
     * Adds Subscription duration.
378
     *
379
     * @param Duration $duration Duration to add
380
     *
381
     * @return Duration
382
     */
383
    public function addRange(Duration $duration)
384
    {
385
        $this->ranges->add($duration);
386
387
        return $this;
388
    }
389
390
    public function getObject()
391
    {
392
        return clone $this;
393
    }
394
395
    public function getContextCurrency()
396
    {
397
        return clone $this;
398
    }
399
400
    public function setTranslatableLocale($locale)
401
    {
402
        $this->locale = $locale;
403
    }
404
405
    public function getTranslations()
406
    {
407
        return $this->translations;
408
    }
409
410
    public function addTranslation(SubscriptionTranslation $translation)
411
    {
412
        if (!$this->translations->contains($translation)) {
413
            $this->translations[] = $translation;
414
            $translation->setObject($this);
415
        }
416
    }
417
418
    /**
419
     * Gets the value of isTemplate.
420
     *
421
     * @return bool
422
     */
423
    public function isTemplate()
424
    {
425
        return $this->isTemplate;
426
    }
427
428
    /**
429
     * Sets the value of isTemplate.
430
     *
431
     * @param bool $isTemplate the is template
432
     */
433
    public function setIsTemplate($isTemplate)
434
    {
435
        $this->isTemplate = $isTemplate;
436
    }
437
}
438