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 | * "Abstract" class for a number of different payment |
||
4 | * types allowing a user to pay for something on a site. |
||
5 | * |
||
6 | * |
||
7 | * This can't be an abstract class because sapphire doesn't |
||
8 | * support abstract DataObject classes. |
||
9 | * |
||
10 | * @package payment |
||
11 | */ |
||
12 | class EcommercePayment_Stripe extends EcommercePayment |
||
0 ignored issues
–
show
|
|||
13 | { |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private static $api_key_public = ""; |
||
0 ignored issues
–
show
|
|||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private static $api_key_private = ""; |
||
0 ignored issues
–
show
|
|||
24 | |||
25 | /** |
||
26 | * set the required privacy link as you see fit... |
||
27 | * also see: https://www.paymentexpress.com/About/Artwork_Downloads |
||
28 | * also see: https://www.paymentexpress.com/About/About_DPS/Privacy_Policy |
||
29 | * @var String |
||
30 | */ |
||
31 | private static $stripe_logo_and_link = ' |
||
0 ignored issues
–
show
|
|||
32 | <div>Stripe Logos go here...</div> |
||
33 | '; |
||
34 | |||
35 | /** |
||
36 | * we use yes / no as this is more reliable than a boolean value |
||
37 | * for configs |
||
38 | * @var String |
||
39 | */ |
||
40 | private static $is_test = "yes"; |
||
0 ignored issues
–
show
|
|||
41 | |||
42 | /** |
||
43 | * we use yes / no as this is more reliable than a boolean value |
||
44 | * for configs |
||
45 | * @var boolean |
||
46 | */ |
||
47 | private static $is_live = "no"; |
||
0 ignored issues
–
show
|
|||
48 | |||
49 | /** |
||
50 | * Incomplete (default): Payment created but nothing confirmed as successful |
||
51 | * Success: Payment successful |
||
52 | * Failure: Payment failed during process |
||
53 | * Pending: Payment awaiting receipt/bank transfer etc |
||
54 | */ |
||
55 | private static $db = array( |
||
0 ignored issues
–
show
|
|||
56 | "StripeID" => "Varchar(64)", |
||
57 | "CardNumber" => "Varchar(19)", |
||
58 | "NameOnCard" => "Varchar(40)", |
||
59 | "ExpiryDate" => "Varchar(4)", |
||
60 | "CVVNumber" => "Varchar(3)", |
||
61 | "Request" => "Text", |
||
62 | "Response" => "Text", |
||
63 | "IdemPotencyKey" => "Text" |
||
64 | ); |
||
65 | |||
66 | private static $casting = array( |
||
0 ignored issues
–
show
|
|||
67 | "RequestDetails" => "HTMLText", |
||
68 | "ResponseDetails" => "HTMLText" |
||
69 | ); |
||
70 | |||
71 | private static $indexes = array( |
||
0 ignored issues
–
show
|
|||
72 | "StripeID" => true |
||
73 | ); |
||
74 | |||
75 | public function getCMSFields() |
||
76 | { |
||
77 | $fields = parent::getCMSFields(); |
||
78 | $fields->addFieldToTab("Root.Debug", new ReadonlyField("ClassName")); |
||
79 | $fields->addFieldToTab("Root.Debug", new LiteralField("Request", "<h2>Request</h2>".$this->getRequestDetails())); |
||
80 | $fields->addFieldToTab("Root.Debug", new LiteralField("SeparatorForRequest", "<hr />")); |
||
81 | $fields->addFieldToTab("Root.Debug", new LiteralField("Response", "<h2>Response</h2>".$this->myResponseDetails())); |
||
82 | return $fields; |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Return the payment form fields that should |
||
87 | * be shown on the checkout order form for the |
||
88 | * payment type. Example: for {@link DPSPayment}, |
||
89 | * this would be a set of fields to enter your |
||
90 | * credit card details. |
||
91 | * |
||
92 | * @return FieldList |
||
93 | */ |
||
94 | public function getPaymentFormFields() |
||
95 | { |
||
96 | $formHelper = $this->ecommercePaymentFormSetupAndValidationObject(); |
||
97 | $fieldList = $formHelper->getCreditCardPaymentFormFields($this); |
||
98 | $fieldList->insertBefore( |
||
99 | new LiteralField("Stripe_Logo", $this->Config()->get("stripe_logo_and_link")), |
||
100 | "EcommercePayment_Stripe_CreditCard" |
||
0 ignored issues
–
show
'EcommercePayment_Stripe_CreditCard' is of type string , but the function expects a object<FormField> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
101 | ); |
||
102 | return $fieldList; |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * Define what fields defined in {@link Order->getPaymentFormFields()} |
||
107 | * should be required. |
||
108 | * |
||
109 | * @see DPSPayment->getPaymentFormRequirements() for an example on how |
||
110 | * this is implemented. |
||
111 | * |
||
112 | * @return array |
||
113 | */ |
||
114 | public function getPaymentFormRequirements() |
||
115 | { |
||
116 | $formHelper = $this->ecommercePaymentFormSetupAndValidationObject(); |
||
117 | return $formHelper->getCreditCardPaymentFormFieldsRequired($this); |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * returns true if all the data is correct. |
||
122 | * |
||
123 | * @param array $data The form request data - see OrderForm |
||
124 | * @param OrderForm $form The form object submitted on |
||
125 | * |
||
126 | * @return Boolean |
||
127 | */ |
||
128 | public function validatePayment($data, $form) |
||
129 | { |
||
130 | $formHelper = $this->ecommercePaymentFormSetupAndValidationObject(); |
||
131 | return $formHelper->validateAndSaveCreditCardInformation($data, $form, $this); |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * Perform payment processing for the type of |
||
136 | * payment. For example, if this was a credit card |
||
137 | * payment type, you would perform the data send |
||
138 | * off to the payment gateway on this function for |
||
139 | * your payment subclass. |
||
140 | * |
||
141 | * This is used by {@link OrderForm} when it is |
||
142 | * submitted. |
||
143 | * |
||
144 | * @param array $data The form request data - see OrderForm |
||
145 | * @param OrderForm $form The form object submitted on |
||
146 | * |
||
147 | * @return EcommercePaymentResult |
||
0 ignored issues
–
show
|
|||
148 | */ |
||
149 | public function processPayment($data, $form) |
||
150 | { |
||
151 | //get variables |
||
152 | $this->retrieveVariables(); |
||
153 | $this->instantiateAPI(); |
||
154 | |||
155 | |||
156 | $requestData = array( |
||
157 | 'card' => $this->_processing_card, |
||
0 ignored issues
–
show
The property
_processing_card does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
158 | 'amount' => $this->_processing_amount, |
||
159 | 'currency' => $this->_processing_currency, |
||
160 | 'statement_descriptor' => $this->_processing_statement_description, |
||
161 | 'metadata' => $this->_processing_metadata |
||
162 | ); |
||
163 | |||
164 | //do stripe bit |
||
165 | |||
166 | $responseData = \Stripe\Charge::create($requestData, $this->_processing_idempotency_key); |
||
0 ignored issues
–
show
The property
_processing_idempotency_key does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
167 | |||
168 | //remove card for security reasons |
||
169 | $this->removeCardDetails(); |
||
170 | $allDetails["card"]["number"] = $this->_processing_truncated_card; |
||
0 ignored issues
–
show
The property
_processing_truncated_card does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() Coding Style
Comprehensibility
introduced
by
$allDetails was never initialized. Although not strictly required by PHP, it is generally a good practice to add $allDetails = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. ![]() |
|||
171 | |||
172 | //now we can save the details: |
||
173 | $this->recordTransaction($requestData, $responseData); |
||
174 | |||
175 | if ( |
||
176 | $responseData && |
||
177 | $responseData->status == "succeeded" |
||
178 | ) { |
||
179 | $this->Status = "Success"; |
||
0 ignored issues
–
show
The property
Status does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
180 | $returnObject = EcommercePayment_Success::create(); |
||
181 | } else { |
||
182 | $this->Status = "Failure"; |
||
0 ignored issues
–
show
The property
Status does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
183 | $returnObject = EcommercePayment_Failure::create(); |
||
184 | } |
||
185 | |||
186 | $this->write(); |
||
187 | return $returnObject; |
||
188 | } |
||
189 | |||
190 | /** |
||
191 | * |
||
192 | * @return string (HTML) |
||
193 | */ |
||
194 | public function getRequestDetails() |
||
195 | { |
||
196 | return "<pre>".print_r(unserialize($this->Request), 1)."</pre>"; |
||
0 ignored issues
–
show
The property
Request does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
197 | } |
||
198 | |||
199 | /** |
||
200 | * |
||
201 | * @return string (HTML) |
||
202 | */ |
||
203 | public function myResponseDetails() |
||
204 | { |
||
205 | return "<pre>".print_r(unserialize($this->Response), 1)."</pre>"; |
||
0 ignored issues
–
show
The property
Response does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
206 | } |
||
207 | |||
208 | /** |
||
209 | * @var Order |
||
210 | */ |
||
211 | protected $_processing_order = null; |
||
212 | |||
213 | /** |
||
214 | * @var float |
||
215 | */ |
||
216 | protected $_processing_amount = 0; |
||
217 | |||
218 | /** |
||
219 | * @var string |
||
220 | */ |
||
221 | protected $_processing_currency = 0; |
||
222 | |||
223 | /** |
||
224 | * @var int |
||
225 | */ |
||
226 | protected $_processing_year = 0; |
||
227 | |||
228 | /** |
||
229 | * @var int |
||
230 | */ |
||
231 | protected $_processing_month = 0; |
||
232 | |||
233 | /** |
||
234 | * @var string |
||
235 | */ |
||
236 | protected $_processing_statement_description = ""; |
||
237 | |||
238 | /** |
||
239 | * @var array |
||
240 | */ |
||
241 | protected $_processing_metadata = array(); |
||
242 | |||
243 | /** |
||
244 | * |
||
245 | * |
||
246 | */ |
||
247 | protected function retrieveVariables() |
||
248 | { |
||
249 | if (!$this->_processing_idempotency_key) { |
||
0 ignored issues
–
show
The property
_processing_idempotency_key does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
250 | if ($this->ID) { |
||
251 | $hash = hash("SHA1", $this->ID."_".$this->ClassName); |
||
252 | } else { |
||
253 | $hash = hash("SHA1", rand(0, 9999999999999999)); |
||
254 | } |
||
255 | $this->_processing_idempotency_key = array("idempotency_key" => $hash); |
||
0 ignored issues
–
show
The property
_processing_idempotency_key does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
256 | $this->_processing_check_code = substr($hash, 0, 22); |
||
0 ignored issues
–
show
The property
_processing_check_code does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
257 | if ($this->OrderID) { |
||
0 ignored issues
–
show
The property
OrderID does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
258 | $order = $this->Order(); |
||
0 ignored issues
–
show
The method
Order does not exist on object<EcommercePayment_Stripe> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
![]() |
|||
259 | } else { |
||
260 | $order = ShoppingCart::current_order(); |
||
261 | } |
||
262 | $this->_processing_order = $order; |
||
263 | $this->_processing_member = $this->_processing_order->Member(); |
||
0 ignored issues
–
show
The property
_processing_member does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
264 | $this->_processing_currency = strtolower($this->Amount->Currency); |
||
0 ignored issues
–
show
The property
Amount does not seem to exist. Did you mean _processing_amount ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
265 | $this->_processing_amount = $this->Amount->Amount * 100; |
||
0 ignored issues
–
show
The property
Amount does not seem to exist. Did you mean _processing_amount ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() It seems like
$this->Amount->Amount * 100 can also be of type integer . However, the property $_processing_amount is declared as type double . Maybe add an additional type check?
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly. For example, imagine you have a variable Either this assignment is in error or a type check should be added for that assignment. class Id
{
public $id;
public function __construct($id)
{
$this->id = $id;
}
}
class Account
{
/** @var Id $id */
public $id;
}
$account_id = false;
if (starsAreRight()) {
$account_id = new Id(42);
}
$account = new Account();
if ($account instanceof Id)
{
$account->id = $account_id;
}
![]() |
|||
266 | $this->_processing_month = substr($this->ExpiryDate, 0, 2); |
||
0 ignored issues
–
show
The property
ExpiryDate does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
$_processing_month was declared of type integer , but substr($this->ExpiryDate, 0, 2) is of type string . 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;
![]() |
|||
267 | $this->_processing_year = substr($this->ExpiryDate, 2, 2); |
||
0 ignored issues
–
show
The property
ExpiryDate does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
$_processing_year was declared of type integer , but substr($this->ExpiryDate, 2, 2) is of type string . 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;
![]() |
|||
268 | $this->_processing_metadata = array( |
||
269 | "OrderID" => $this->_processing_order->ID, |
||
270 | "EcommercePaymentID" => $this->ID |
||
271 | ); |
||
272 | $this->_processing_statement_description = $this->_processing_check_code; |
||
0 ignored issues
–
show
The property
_processing_check_code does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
273 | if ($this->hasFullCardNumber()) { |
||
274 | $this->_processing_card = array( |
||
0 ignored issues
–
show
The property
_processing_card does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
275 | 'number' => $this->CardNumber, |
||
0 ignored issues
–
show
The property
CardNumber does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
276 | 'exp_month' => $this->_processing_month, |
||
277 | 'exp_year' => $this->_processing_year, |
||
278 | 'name' => $this->NameOnCard |
||
0 ignored issues
–
show
The property
NameOnCard does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
279 | ); |
||
280 | $this->_processing_truncated_card = substr($this->CardNumber, 12, 4); |
||
0 ignored issues
–
show
The property
_processing_truncated_card does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
CardNumber does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
281 | $this->_processing_card_description = |
||
0 ignored issues
–
show
The property
_processing_card_description does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
282 | "...".$this->_processing_truncated_card. |
||
0 ignored issues
–
show
The property
_processing_truncated_card does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
283 | "; exp: ".$this->_processing_month."-".$this->_processing_year. |
||
284 | "; name: ".$this->NameOnCard; |
||
0 ignored issues
–
show
The property
NameOnCard does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
285 | } |
||
286 | } |
||
287 | } |
||
288 | |||
289 | /** |
||
290 | * |
||
291 | * |
||
292 | */ |
||
293 | protected function instantiateAPI() |
||
294 | { |
||
295 | $api = $this->Config()->get("api_key_private"); |
||
296 | \Stripe\Stripe::setApiKey($api); |
||
297 | } |
||
298 | |||
299 | /** |
||
300 | * remove the card details |
||
301 | * for securityu reasons |
||
302 | */ |
||
303 | protected function removeCardDetails() |
||
304 | { |
||
305 | if ($this->hasFullCardNumber()) { |
||
306 | $this->CardNumber = $this->_processing_truncated_card; |
||
0 ignored issues
–
show
The property
CardNumber does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
_processing_truncated_card does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
307 | $this->_processing_card = null; |
||
0 ignored issues
–
show
The property
_processing_card does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
308 | } |
||
309 | } |
||
310 | |||
311 | /** |
||
312 | * is the full credit card recorded? |
||
313 | * @return boolean |
||
314 | */ |
||
315 | protected function hasFullCardNumber() |
||
316 | { |
||
317 | return strlen($this->CardNumber) > 12; |
||
0 ignored issues
–
show
The property
CardNumber does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
318 | } |
||
319 | |||
320 | /** |
||
321 | * @param mixed $requestData; |
||
0 ignored issues
–
show
There is no parameter named
$requestData; . Did you maybe mean $requestData ?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit. Consider the following example. The parameter /**
* @param array $germany
* @param array $ireland
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was changed, but the annotation was not. ![]() |
|||
322 | * @param mixed $responseData; |
||
0 ignored issues
–
show
There is no parameter named
$responseData; . Did you maybe mean $responseData ?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit. Consider the following example. The parameter /**
* @param array $germany
* @param array $ireland
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was changed, but the annotation was not. ![]() |
|||
323 | */ |
||
324 | protected function recordTransaction($requestData, $responseData) |
||
325 | { |
||
326 | $this->Request = serialize($requestData); |
||
0 ignored issues
–
show
The property
Request does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
327 | $this->Response = serialize($responseData); |
||
0 ignored issues
–
show
The property
Response does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
328 | if ($responseData && isset($responseData->id)) { |
||
329 | $this->StripeID = $responseData->id; |
||
0 ignored issues
–
show
The property
StripeID does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
330 | //$this->IdemPotencyKey = $responseData->getLastReponse()->header["Idempotency-Key"]; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
65% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
331 | } |
||
332 | if ($this->_processing_amount) { |
||
333 | //no idea why we need this!!! |
||
334 | $this->Amount->Amount = $this->_processing_amount / 100; |
||
0 ignored issues
–
show
The property
Amount does not seem to exist. Did you mean _processing_amount ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
335 | } |
||
336 | $this->Message = _t("EcommercePayment_Stripe", "TRANSACTION_CODE").": ".$this->_processing_check_code; |
||
0 ignored issues
–
show
The property
Message does not exist on object<EcommercePayment_Stripe> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
_processing_check_code does not exist on object<EcommercePayment_Stripe> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
337 | } |
||
338 | } |
||
339 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.