Issues (187)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

code/DpsPxPost.php (34 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
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
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
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
The property $dps_logo_and_link is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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
The property $is_test is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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
The property $is_live is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
45
46
    /**
47
     *
48
     * @var string
49
     */
50
    private static $username = "";
0 ignored issues
show
The property $username is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
51
52
    /**
53
     *
54
     * @var string
55
     */
56
    private static $password = "";
0 ignored issues
show
The property $password is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
57
58
    /**
59
     * type: purchase / Authorisation / refund ...
60
     * @var string
61
     */
62
    private static $type = "Purchase";
0 ignored issues
show
The property $type is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
The property $db is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
The property $casting is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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);
Loading history...
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
Should the return type not be FieldList?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
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 $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
163
        $order = $this->Order();
0 ignored issues
show
Documentation Bug introduced by
The method Order does not exist on object<DpsPxPost>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

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 { }
Loading history...
$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 $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
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 _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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.

Loading history...
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.

Loading history...
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 _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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
Should the return type not be boolean|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
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 _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
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 _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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.

Loading history...
250
    }
251
}
252