Failed Conditions
Push — develop ( eec6db...468d8c )
by Reüel
07:22
created

src/XML/DirectTransactionResponseMessage.php (1 issue)

1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\MultiSafepay\XML;
4
5
use Pronamic\WordPress\Pay\Core\XML\Security;
6
use Pronamic\WordPress\Pay\Gateways\MultiSafepay\GatewayInfo;
7
use SimpleXMLElement;
8
9
/**
10
 * Title: MultiSafepay Connect XML direct transaction response message
11
 * Description:
12
 * Copyright: 2005-2020 Pronamic
13
 * Company: Pronamic
14
 *
15
 * @author  Remco Tolsma
16
 * @version 2.0.2
17
 * @since   1.2.0
18
 */
19
class DirectTransactionResponseMessage {
20
	/**
21
	 * Result
22
	 *
23
	 * @var string
24
	 */
25
	public $result;
26
27
	/**
28
	 * Transaction
29
	 *
30
	 * @var DirectTransactionResponseMessage
31
	 */
32
	public $transaction;
33
34
	/**
35
	 * Gateway info.
36
	 *
37
	 * @var GatewayInfo
38
	 */
39
	public $gateway_info;
40
41
	/**
42
	 * Parse the specified XML element into an iDEAL transaction object
43
	 *
44
	 * @param SimpleXMLElement $xml
45
	 *
46
	 * @return DirectTransactionResponseMessage
47
	 */
48 2
	public static function parse( SimpleXMLElement $xml ) {
49
		// Message
50 2
		$message = new DirectTransactionResponseMessage();
51
52
		// Result
53 2
		$message->result = Security::filter( $xml['result'] );
54
55
		// Transaction
56 2
		$message->transaction = TransactionParser::parse( $xml->transaction );
0 ignored issues
show
Documentation Bug introduced by
It seems like Pronamic\WordPress\Pay\G...arse($xml->transaction) of type Pronamic\WordPress\Pay\G...ultiSafepay\Transaction is incompatible with the declared type Pronamic\WordPress\Pay\G...nsactionResponseMessage of property $transaction.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
57
58
		// Gateway info
59 2
		if ( $xml->gatewayinfo ) {
60 2
			$message->gateway_info               = new GatewayInfo();
61 2
			$message->gateway_info->redirect_url = Security::filter( $xml->gatewayinfo->redirecturl );
62 2
			$message->gateway_info->ext_var      = Security::filter( $xml->gatewayinfo->extvar );
63 2
			$message->gateway_info->issuer_id    = Security::filter( $xml->gatewayinfo->issuerid );
64
		}
65
66 2
		return $message;
67
	}
68
}
69