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 | /* |
||
4 | * This file is part of the Nexylan packages. |
||
5 | * |
||
6 | * (c) Nexylan SAS <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Nexy\PayboxDirect\Request; |
||
13 | |||
14 | use Greg0ire\Enum\Bridge\Symfony\Validator\Constraint\Enum; |
||
15 | use Symfony\Component\Validator\Constraints as Assert; |
||
16 | |||
17 | /** |
||
18 | * @author Sullivan Senechal <[email protected]> |
||
19 | */ |
||
20 | abstract class AbstractRequest implements RequestInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var int |
||
24 | * |
||
25 | * @Enum(class="Nexy\PayboxDirect\Enum\Activity", showKeys=true) |
||
26 | */ |
||
27 | private $activity = null; |
||
28 | |||
29 | /** |
||
30 | * @var \DateTime |
||
31 | * |
||
32 | * @Assert\Type("\DateTime") |
||
33 | */ |
||
34 | private $date = null; |
||
35 | |||
36 | /** |
||
37 | * @var bool |
||
38 | * |
||
39 | * @Assert\Type("bool") |
||
40 | */ |
||
41 | private $showCountry = false; |
||
42 | |||
43 | /** |
||
44 | * @var bool |
||
45 | * |
||
46 | * @Assert\Type("bool") |
||
47 | */ |
||
48 | private $showSha1 = false; |
||
49 | |||
50 | /** |
||
51 | * @var bool |
||
52 | * |
||
53 | * @Assert\Type("bool") |
||
54 | */ |
||
55 | private $showCardType = false; |
||
56 | |||
57 | /** |
||
58 | * @var string|null |
||
59 | * |
||
60 | * @Assert\Type("string") |
||
61 | * @Assert\Length(min=1, max=250) |
||
62 | */ |
||
63 | private $subscriberRef = null; |
||
64 | |||
65 | /** |
||
66 | * @param null|string $subscriberRef |
||
67 | */ |
||
68 | public function __construct($subscriberRef = null) |
||
69 | { |
||
70 | $this->subscriberRef = $subscriberRef; |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * @param int $activity |
||
75 | * |
||
76 | * @return $this |
||
77 | */ |
||
78 | final public function setActivity($activity) |
||
79 | { |
||
80 | $this->activity = $activity; |
||
81 | |||
82 | return $this; |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * @param \DateTime|null $date |
||
87 | * |
||
88 | * @return $this |
||
89 | */ |
||
90 | final public function setDate(\DateTime $date = null) |
||
91 | { |
||
92 | $this->date = $date; |
||
93 | |||
94 | return $this; |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * @param bool $showCountry |
||
99 | * |
||
100 | * @return $this |
||
101 | */ |
||
102 | final public function setShowCountry($showCountry) |
||
103 | { |
||
104 | $this->showCountry = $showCountry; |
||
105 | |||
106 | return $this; |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * @param bool $showSha1 |
||
111 | * |
||
112 | * @return $this |
||
113 | */ |
||
114 | final public function setShowSha1($showSha1) |
||
115 | { |
||
116 | $this->showSha1 = $showSha1; |
||
117 | |||
118 | return $this; |
||
119 | } |
||
120 | |||
121 | /** |
||
122 | * @param bool $showCardType |
||
123 | * |
||
124 | * @return $this |
||
125 | */ |
||
126 | final public function setShowCardType($showCardType) |
||
127 | { |
||
128 | $this->showCardType = $showCardType; |
||
129 | |||
130 | return $this; |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * @return bool |
||
135 | */ |
||
136 | final protected function hasSubscriberRef() |
||
137 | { |
||
138 | return !empty($this->subscriberRef); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * @return null|string |
||
143 | */ |
||
144 | final protected function getSubscriberRef() |
||
145 | { |
||
146 | return $this->subscriberRef; |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * {@inheritdoc} |
||
151 | */ |
||
152 | public function getParameters() |
||
153 | { |
||
154 | $parameters = [ |
||
155 | 'DATEQ' => $this->date instanceof \DateTime ? $this->date->format('dmYHis') : null, |
||
156 | ]; |
||
157 | |||
158 | if ($this->activity) { |
||
159 | $parameters['ACTIVITE'] = $this->activity; |
||
160 | } |
||
161 | if ($this->showCountry) { |
||
162 | $parameters['PAYS'] = ''; |
||
163 | } |
||
164 | if ($this->showSha1) { |
||
165 | $parameters['SHA-1'] = ''; |
||
166 | } |
||
167 | if ($this->showCardType) { |
||
168 | $parameters['TYPECARTE'] = ''; |
||
169 | } |
||
170 | |||
171 | if (method_exists($this, 'getTransactionNumber')) { |
||
172 | $parameters['NUMTRANS'] = $this->getTransactionNumber(); |
||
0 ignored issues
–
show
|
|||
173 | } |
||
174 | if (method_exists($this, 'getCallNumber')) { |
||
175 | $parameters['NUMAPPEL'] = $this->getCallNumber(); |
||
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Nexy\PayboxDirect\Request\AbstractRequest as the method getCallNumber() does only exist in the following sub-classes of Nexy\PayboxDirect\Request\AbstractRequest : Nexy\PayboxDirect\Reques...encedTransactionRequest , Nexy\PayboxDirect\Reques...beredTransactionRequest , Nexy\PayboxDirect\Request\CancelRequest , Nexy\PayboxDirect\Request\DebitRequest , Nexy\PayboxDirect\Request\InquiryRequest , Nexy\PayboxDirect\Request\RefundRequest , Nexy\PayboxDirect\Reques...ancelTransactionRequest , Nexy\PayboxDirect\Request\UpdateAmountRequest . Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
176 | } |
||
177 | if (method_exists($this, 'hasAuthorization') && $this->hasAuthorization()) { |
||
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Nexy\PayboxDirect\Request\AbstractRequest as the method hasAuthorization() does only exist in the following sub-classes of Nexy\PayboxDirect\Request\AbstractRequest : Nexy\PayboxDirect\Reques...horizeAndCaptureRequest , Nexy\PayboxDirect\Request\AuthorizeRequest , Nexy\PayboxDirect\Reques...bscriberRegisterRequest , Nexy\PayboxDirect\Request\SubscriberUpdateRequest , Nexy\PayboxDirect\Request\UpdateAmountRequest . Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
178 | $parameters['AUTORISATION'] = $this->getAuthorization(); |
||
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Nexy\PayboxDirect\Request\AbstractRequest as the method getAuthorization() does only exist in the following sub-classes of Nexy\PayboxDirect\Request\AbstractRequest : Nexy\PayboxDirect\Reques...horizeAndCaptureRequest , Nexy\PayboxDirect\Request\AuthorizeRequest , Nexy\PayboxDirect\Reques...bscriberRegisterRequest , Nexy\PayboxDirect\Request\SubscriberUpdateRequest , Nexy\PayboxDirect\Request\UpdateAmountRequest . Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
179 | } |
||
180 | |||
181 | // Direct Plus requests special case. |
||
182 | if ($this->hasSubscriberRef()) { |
||
183 | $parameters['REFABONNE'] = $this->getSubscriberRef(); |
||
184 | } |
||
185 | |||
186 | return $parameters; |
||
187 | } |
||
188 | } |
||
189 |
Let’s take a look at an example:
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.
Available Fixes
Change the type-hint for the parameter:
Add an additional type-check:
Add the method to the parent class: