This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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
|
|||
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 ![]() |
|||
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 |
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.