Issues (7)

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.

Entity/Transaction.php (2 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 Beelab\PaypalBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * Transaction.
9
 *
10
 * @ORM\MappedSuperclass
11
 */
12
abstract class Transaction
0 ignored issues
show
Transaction does not seem to conform to the naming convention (^Abstract|Factory$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
13
{
14
    const STATUS_KO = -1;
15
    const STATUS_STARTED = 0;
16
    const STATUS_OK = 1;
17
    const STATUS_ERROR = 2;
18
19
    public static $statuses = [
20
        self::STATUS_STARTED => 'started',
21
        self::STATUS_OK => 'success',
22
        self::STATUS_KO => 'canceled',
23
        self::STATUS_ERROR => 'failed',
24
    ];
25
26
    /**
27
     * @var int
28
     *
29
     * @ORM\Column(type="integer")
30
     * @ORM\Id
31
     * @ORM\GeneratedValue(strategy="AUTO")
32
     */
33
    protected $id;
34
35
    /**
36
     * @var \DateTime
37
     *
38
     * @ORM\Column(type="datetime")
39
     */
40
    protected $start;
41
42
    /**
43
     * @var \DateTime
44
     *
45
     * @ORM\Column(type="datetime", nullable=true)
46
     */
47
    protected $end;
48
49
    /**
50
     * @var int
51
     *
52
     * @ORM\Column(type="smallint", options={"default": 0})
53
     */
54
    protected $status = self::STATUS_STARTED;
55
56
    /**
57
     * @var string
58
     *
59
     * @ORM\Column(unique=true)
60
     */
61
    protected $token;
62
63
    /**
64
     * @var string
65
     *
66
     * @ORM\Column(type="decimal", precision=6, scale=2, options={"default": 0})
67
     */
68
    protected $amount = 0;
69
70
    /**
71
     * @var array
72
     *
73
     * @ORM\Column(type="array")
74
     */
75
    protected $response;
76
77
    public function __construct($amount = null)
78
    {
79
        $this->amount = $amount;
80
        $this->start = new \DateTime();
81
    }
82
83
    public function getId(): ?int
84
    {
85
        return $this->id;
86
    }
87
88
    public function setStart(?\DateTime $start): self
89
    {
90
        $this->start = $start;
91
92
        return $this;
93
    }
94
95
    public function getStart(): ?\DateTime
96
    {
97
        return $this->start;
98
    }
99
100
    public function setEnd(?\DateTime $end): self
101
    {
102
        $this->end = $end;
103
104
        return $this;
105
    }
106
107
    public function getEnd(): ?\DateTime
108
    {
109
        return $this->end;
110
    }
111
112
    public function setStatus(?int $status): ?int
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
113
    {
114
        $this->status = $status;
115
116
        return $status;
117
    }
118
119
    public function getStatus(): ?int
120
    {
121
        return $this->status;
122
    }
123
124
    public function getStatusLabel(): string
125
    {
126
        return isset(static::$statuses[$this->status]) ? static::$statuses[$this->status] : 'invalid';
127
    }
128
129
    public function setToken(?string $token): self
130
    {
131
        $this->token = $token;
132
133
        return $this;
134
    }
135
136
    public function getToken(): ?string
137
    {
138
        return $this->token;
139
    }
140
141
    public function getAmount(): ?string
142
    {
143
        return $this->amount;
144
    }
145
146
    public function getResponse(): ?array
147
    {
148
        return $this->response;
149
    }
150
151
    public function complete(array $response): void
152
    {
153
        if (self::STATUS_OK !== $this->status) {
154
            $this->status = self::STATUS_OK;
155
            $this->end = new \DateTime();
156
            $this->response = $response;
157
        }
158
    }
159
160
    public function cancel(): void
161
    {
162
        $this->status = self::STATUS_KO;
163
        $this->end = new \DateTime();
164
    }
165
166
    public function error(array $response): void
167
    {
168
        $this->status = self::STATUS_ERROR;
169
        $this->end = new \DateTime();
170
        $this->response = $response;
171
    }
172
173
    public function isOk(): bool
174
    {
175
        return self::STATUS_OK === $this->status;
176
    }
177
178
    public function getDescription(): ?string
179
    {
180
        return null;
181
    }
182
183
    public function getItems(): array
184
    {
185
        return [];
186
    }
187
188
    public function getShippingAmount(): string
189
    {
190
        return '0.00';
191
    }
192
}
193