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 | * |
||
5 | * |
||
6 | * @see: https://www.paymentexpress.com/Technical_Resources/Ecommerce_NonHosted/PxPost |
||
7 | */ |
||
8 | |||
9 | |||
10 | class DpsPxPost extends EcommercePayment |
||
0 ignored issues
–
show
|
|||
11 | { |
||
12 | |||
13 | /** |
||
14 | * set the required privacy link as you see fit... |
||
15 | * also see: https://www.paymentexpress.com/About/Artwork_Downloads |
||
16 | * also see: https://www.paymentexpress.com/About/About_DPS/Privacy_Policy |
||
17 | * @var String |
||
18 | */ |
||
19 | private static $dps_logo_and_link = ' |
||
0 ignored issues
–
show
|
|||
20 | <div id="PXPostPrivacy"> |
||
21 | <a href="https://www.paymentexpress.com/About/About_DPS/Privacy_Policy"> |
||
22 | <img src="https://www.paymentexpress.com/DPS/media/theme/pxlogostackedreg.png" alt="Payment Processor" width="50%" height="50%" /> |
||
23 | </a> |
||
24 | <span> |
||
25 | <a href="https://www.paymentexpress.com/About/About_DPS/Privacy_Policy"> |
||
26 | Payment processing provided by DPS (view Privacy Policy) |
||
27 | </a> |
||
28 | </span> |
||
29 | </div> |
||
30 | '; |
||
31 | |||
32 | /** |
||
33 | * we use yes / no as this is more reliable than a boolean value |
||
34 | * for configs |
||
35 | * @var String |
||
36 | */ |
||
37 | private static $is_test = "yes"; |
||
0 ignored issues
–
show
|
|||
38 | |||
39 | /** |
||
40 | * we use yes / no as this is more reliable than a boolean value |
||
41 | * for configs |
||
42 | * @var boolean |
||
43 | */ |
||
44 | private static $is_live = "no"; |
||
0 ignored issues
–
show
|
|||
45 | |||
46 | /** |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | private static $username = ""; |
||
0 ignored issues
–
show
|
|||
51 | |||
52 | /** |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | private static $password = ""; |
||
0 ignored issues
–
show
|
|||
57 | |||
58 | /** |
||
59 | * type: purchase / Authorisation / refund ... |
||
60 | * @var string |
||
61 | */ |
||
62 | private static $type = "Purchase"; |
||
0 ignored issues
–
show
|
|||
63 | |||
64 | /** |
||
65 | * Incomplete (default): Payment created but nothing confirmed as successful |
||
66 | * Success: Payment successful |
||
67 | * Failure: Payment failed during process |
||
68 | * Pending: Payment awaiting receipt/bank transfer etc |
||
69 | */ |
||
70 | private static $db = array( |
||
0 ignored issues
–
show
|
|||
71 | "CardNumber" => "Varchar(64)", |
||
72 | "NameOnCard" => "Varchar(40)", |
||
73 | "ExpiryDate" => "Varchar(4)", |
||
74 | "CVVNumber" => "Varchar(3)", |
||
75 | "Request" => "Text", |
||
76 | "Response" => "Text" |
||
77 | ); |
||
78 | |||
79 | private static $casting = array( |
||
0 ignored issues
–
show
|
|||
80 | "RequestDetails" => "HTMLText", |
||
81 | "ResponseDetails" => "HTMLText" |
||
82 | ); |
||
83 | |||
84 | public function getCMSFields() |
||
85 | { |
||
86 | $fields = parent::getCMSFields(); |
||
87 | $fields->addFieldToTab("Root.Details", new LiteralField("Request", $this->getRequestDetails())); |
||
88 | $fields->addFieldToTab("Root.Details", new LiteralField("Response", $this->getResponseDetails())); |
||
89 | return $fields; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * Return the payment form fields that should |
||
94 | * be shown on the checkout order form for the |
||
95 | * payment type. Example: for {@link DPSPayment}, |
||
96 | * this would be a set of fields to enter your |
||
97 | * credit card details. |
||
98 | * |
||
99 | * @return FieldList |
||
100 | */ |
||
101 | public function getPaymentFormFields() |
||
102 | { |
||
103 | $formHelper = $this->ecommercePaymentFormSetupAndValidationObject(); |
||
104 | $fieldList = $formHelper->getCreditCardPaymentFormFields($this); |
||
105 | $fieldList->insertBefore( |
||
106 | new LiteralField("DpsPxPost_Logo", $this->Config()->get("dps_logo_and_link")), |
||
107 | "DpsPxPost_CreditCard" |
||
0 ignored issues
–
show
'DpsPxPost_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);
![]() |
|||
108 | ); |
||
109 | return $fieldList; |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * Define what fields defined in {@link Order->getPaymentFormFields()} |
||
114 | * should be required. |
||
115 | * |
||
116 | * @see DPSPayment->getPaymentFormRequirements() for an example on how |
||
117 | * this is implemented. |
||
118 | * |
||
119 | * @return array |
||
0 ignored issues
–
show
|
|||
120 | */ |
||
121 | public function getPaymentFormRequirements() |
||
122 | { |
||
123 | $formHelper = $this->ecommercePaymentFormSetupAndValidationObject(); |
||
124 | return $formHelper->getCreditCardPaymentFormFields($this); |
||
125 | } |
||
126 | |||
127 | /** |
||
128 | * returns true if all the data is correct. |
||
129 | * |
||
130 | * @param array $data The form request data - see OrderForm |
||
131 | * @param OrderForm $form The form object submitted on |
||
132 | * |
||
133 | * @return Boolean |
||
134 | */ |
||
135 | public function validatePayment($data, $form) |
||
136 | { |
||
137 | $formHelper = $this->ecommercePaymentFormSetupAndValidationObject(); |
||
138 | return $formHelper->validateAndSaveCreditCardInformation($data, $form, $this); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * Perform payment processing for the type of |
||
143 | * payment. For example, if this was a credit card |
||
144 | * payment type, you would perform the data send |
||
145 | * off to the payment gateway on this function for |
||
146 | * your payment subclass. |
||
147 | * |
||
148 | * This is used by {@link OrderForm} when it is |
||
149 | * submitted. |
||
150 | * |
||
151 | * @param array $data The form request data - see OrderForm |
||
152 | * @param OrderForm $form The form object submitted on |
||
153 | * |
||
154 | * @return EcommercePayment_Result |
||
155 | */ |
||
156 | public function processPayment($data, $form) |
||
157 | { |
||
158 | //save data |
||
159 | $this->write(); |
||
160 | |||
161 | //get variables |
||
162 | $isTest = $this->isTest(); |
||
0 ignored issues
–
show
$isTest is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
163 | $order = $this->Order(); |
||
0 ignored issues
–
show
The method
Order does not exist on object<DpsPxPost> ? 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 { }
![]() $order is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
164 | //if currency has been pre-set use this |
||
165 | $currency = strtoupper($this->Amount->Currency); |
||
0 ignored issues
–
show
The property
Amount does not exist on object<DpsPxPost> . 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. ![]() |
|||
166 | //if amout has been pre-set, use this |
||
167 | $amount = $this->Amount->Amount; |
||
0 ignored issues
–
show
The property
Amount does not exist on object<DpsPxPost> . 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. ![]() |
|||
168 | $username = $this->Config()->get("username"); |
||
169 | $password = $this->Config()->get("password"); |
||
170 | if (!$username || !$password) { |
||
171 | user_error("Make sure to set a username and password."); |
||
172 | } |
||
173 | |||
174 | $xml = "<Txn>"; |
||
175 | $xml .= "<PostUsername>".$username."</PostUsername>"; |
||
176 | $xml .= "<PostPassword>".$password."</PostPassword>"; |
||
177 | $xml .= "<CardHolderName>".Convert::raw2xml($this->NameOnCard)."</CardHolderName>"; |
||
0 ignored issues
–
show
The property
NameOnCard does not exist on object<DpsPxPost> . 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. ![]() |
|||
178 | $xml .= "<CardNumber>".$this->CardNumber."</CardNumber>"; |
||
0 ignored issues
–
show
The property
CardNumber does not exist on object<DpsPxPost> . 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. ![]() |
|||
179 | $xml .= "<Amount>".round($amount, 2)."</Amount>"; |
||
180 | $xml .= "<DateExpiry>".$this->ExpiryDate."</DateExpiry>"; |
||
0 ignored issues
–
show
The property
ExpiryDate does not exist on object<DpsPxPost> . 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. ![]() |
|||
181 | $xml .= "<Cvc2>".$this->CVVNumber."</Cvc2>"; |
||
0 ignored issues
–
show
The property
CVVNumber does not exist on object<DpsPxPost> . 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. ![]() |
|||
182 | $xml .= "<Cvc2Presence>1</Cvc2Presence>"; |
||
183 | $xml .= "<InputCurrency>".Convert::raw2xml(strtoupper($currency))."</InputCurrency>"; |
||
184 | $xml .= "<TxnType>".Convert::raw2xml($this->Config()->get("type"))."</TxnType>"; |
||
185 | $xml .= "<TxnId>".$this->ID."</TxnId>"; |
||
186 | $xml .= "<MerchantReference>".$this->OrderID."</MerchantReference>"; |
||
0 ignored issues
–
show
The property
OrderID does not exist on object<DpsPxPost> . 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. ![]() |
|||
187 | $xml .= "</Txn>"; |
||
188 | $URL = "sec.paymentexpress.com/pxpost.aspx"; |
||
189 | //echo "\n\n\n\nSENT:\n$cmdDoTxnTransaction\n\n\n\n\n$"; |
||
190 | |||
191 | $ch = curl_init(); |
||
192 | curl_setopt($ch, CURLOPT_URL, "https://".$URL); |
||
193 | curl_setopt($ch, CURLOPT_POST, 1); |
||
194 | curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); |
||
195 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
||
196 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); //Needs to be included if no *.crt is available to verify SSL certificates |
||
197 | |||
198 | $result = curl_exec($ch); |
||
199 | curl_close($ch); |
||
200 | |||
201 | $params = new SimpleXMLElement($result); |
||
202 | $txn = $params->Transaction; |
||
0 ignored issues
–
show
The property
Transaction does not seem to exist in SimpleXMLElement .
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. ![]() |
|||
203 | |||
204 | //save basic info |
||
205 | //$this->Request = Convert::raw2sql($xml); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
54% 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. ![]() |
|||
206 | $this->Response = str_replace('\n', "\n", Convert::raw2sql(print_r($params, 1))); |
||
0 ignored issues
–
show
The property
Response does not exist on object<DpsPxPost> . 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. ![]() |
|||
207 | $this->Message = Convert::raw2sql($txn->CardHolderResponseText." ".$txn->CardHolderResponseDescription); |
||
0 ignored issues
–
show
The property
Message does not exist on object<DpsPxPost> . 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. ![]() |
|||
208 | $this->CardNumber = Convert::raw2sql($txn->CardNumber); |
||
0 ignored issues
–
show
The property
CardNumber does not exist on object<DpsPxPost> . 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. ![]() |
|||
209 | if ( |
||
210 | $params->Success == 1 && |
||
211 | $amount == $txn->Amount && |
||
212 | $currency == $txn->CurrencyName && |
||
213 | trim($this->OrderID) == trim($txn->MerchantReference) |
||
0 ignored issues
–
show
The property
OrderID does not exist on object<DpsPxPost> . 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. ![]() |
|||
214 | ) { |
||
215 | $this->Status = "Success"; |
||
0 ignored issues
–
show
The property
Status does not exist on object<DpsPxPost> . 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. ![]() |
|||
216 | $returnObject = EcommercePayment_Success::create(); |
||
217 | } else { |
||
218 | $this->Status = "Failure"; |
||
0 ignored issues
–
show
The property
Status does not exist on object<DpsPxPost> . 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. ![]() |
|||
219 | $returnObject = EcommercePayment_Failure::create(); |
||
220 | } |
||
221 | $this->write(); |
||
222 | return $returnObject; |
||
223 | } |
||
224 | |||
225 | |||
226 | /** |
||
227 | * are you running in test mode? |
||
228 | * |
||
229 | * @return Boolean |
||
0 ignored issues
–
show
|
|||
230 | */ |
||
231 | protected function isTest() |
||
232 | { |
||
233 | if ($this->Config()->get("is_test") == "yes" && $this->Config()->get("is_live") == "no") { |
||
234 | return true; |
||
235 | } elseif ($this->Config()->get("is_test") == "no" && $this->Config()->get("is_live") == "yes") { |
||
236 | return false; |
||
237 | } else { |
||
238 | user_error("Class not set to live or test correctly."); |
||
239 | } |
||
240 | } |
||
241 | |||
242 | public function getRequestDetails() |
||
243 | { |
||
244 | return "<pre>".$this->Request."</pre>"; |
||
0 ignored issues
–
show
The property
Request does not exist on object<DpsPxPost> . 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. ![]() |
|||
245 | } |
||
246 | |||
247 | public function getResponseDetails() |
||
248 | { |
||
249 | return "<pre>".$this->Response."</pre>"; |
||
0 ignored issues
–
show
The property
Response does not exist on object<DpsPxPost> . 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 | } |
||
251 | } |
||
252 |
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.