@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * Constructs and initialize an directory response message |
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | - parent::__construct( self::NAME ); |
|
36 | + parent::__construct(self::NAME); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return ResponseMessage |
54 | 54 | */ |
55 | - public static function parse( SimpleXMLElement $xml ) { |
|
56 | - $message = self::parse_create_date( $xml, new self() ); |
|
55 | + public static function parse(SimpleXMLElement $xml) { |
|
56 | + $message = self::parse_create_date($xml, new self()); |
|
57 | 57 | |
58 | - $message->directory = DirectoryParser::parse( $xml->Directory ); |
|
58 | + $message->directory = DirectoryParser::parse($xml->Directory); |
|
59 | 59 | |
60 | 60 | return $message; |
61 | 61 | } |
@@ -24,21 +24,21 @@ |
||
24 | 24 | * |
25 | 25 | * @return Issuer |
26 | 26 | */ |
27 | - public static function parse( SimpleXMLElement $xml, $issuer = null ) { |
|
28 | - if ( ! $issuer instanceof Issuer ) { |
|
27 | + public static function parse(SimpleXMLElement $xml, $issuer = null) { |
|
28 | + if ( ! $issuer instanceof Issuer) { |
|
29 | 29 | $issuer = new Issuer(); |
30 | 30 | } |
31 | 31 | |
32 | - if ( $xml->issuerID ) { |
|
33 | - $issuer->set_id( Security::filter( $xml->issuerID ) ); |
|
32 | + if ($xml->issuerID) { |
|
33 | + $issuer->set_id(Security::filter($xml->issuerID)); |
|
34 | 34 | } |
35 | 35 | |
36 | - if ( $xml->issuerName ) { |
|
37 | - $issuer->set_name( Security::filter( $xml->issuerName ) ); |
|
36 | + if ($xml->issuerName) { |
|
37 | + $issuer->set_name(Security::filter($xml->issuerName)); |
|
38 | 38 | } |
39 | 39 | |
40 | - if ( $xml->issuerAuthenticationURL ) { |
|
41 | - $issuer->set_authentication_url( Security::filter( $xml->issuerAuthenticationURL ) ); |
|
40 | + if ($xml->issuerAuthenticationURL) { |
|
41 | + $issuer->set_authentication_url(Security::filter($xml->issuerAuthenticationURL)); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return $issuer; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * Constructs and initialize an status response message |
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | - parent::__construct( self::NAME ); |
|
36 | + parent::__construct(self::NAME); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return ResponseMessage |
45 | 45 | */ |
46 | - public static function parse( SimpleXMLElement $xml ) { |
|
47 | - $message = self::parse_create_date( $xml, new self() ); |
|
46 | + public static function parse(SimpleXMLElement $xml) { |
|
47 | + $message = self::parse_create_date($xml, new self()); |
|
48 | 48 | |
49 | - $message->transaction = TransactionParser::parse( $xml->Transaction ); |
|
49 | + $message->transaction = TransactionParser::parse($xml->Transaction); |
|
50 | 50 | |
51 | 51 | return $message; |
52 | 52 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * Constructs and initialize an error response message |
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | - parent::__construct( self::NAME ); |
|
36 | + parent::__construct(self::NAME); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return ResponseMessage |
45 | 45 | */ |
46 | - public static function parse( SimpleXMLElement $xml ) { |
|
47 | - $message = self::parse_create_date( $xml, new self() ); |
|
46 | + public static function parse(SimpleXMLElement $xml) { |
|
47 | + $message = self::parse_create_date($xml, new self()); |
|
48 | 48 | |
49 | 49 | $parser = new ErrorParser(); |
50 | 50 | |
51 | - $message->error = $parser->parse( $xml->Error ); |
|
51 | + $message->error = $parser->parse($xml->Error); |
|
52 | 52 | |
53 | 53 | return $message; |
54 | 54 | } |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * Constructs and initialize an message |
66 | 66 | */ |
67 | - public function __construct( $name ) { |
|
67 | + public function __construct($name) { |
|
68 | 68 | $this->name = $name; |
69 | - $this->create_date = new DateTime( null, new DateTimeZone( Plugin::TIMEZONE ) ); |
|
69 | + $this->create_date = new DateTime(null, new DateTimeZone(Plugin::TIMEZONE)); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return DateTime |
94 | 94 | */ |
95 | - public function set_create_date( DateTime $create_date ) { |
|
95 | + public function set_create_date(DateTime $create_date) { |
|
96 | 96 | $this->create_date = $create_date; |
97 | 97 | } |
98 | 98 | |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return \DOMElement |
108 | 108 | */ |
109 | - public static function add_element( DOMDocument $document, DOMNode $parent, $name, $value = null ) { |
|
110 | - $element = $document->createElement( $name ); |
|
109 | + public static function add_element(DOMDocument $document, DOMNode $parent, $name, $value = null) { |
|
110 | + $element = $document->createElement($name); |
|
111 | 111 | |
112 | - if ( null !== $value ) { |
|
113 | - $element->appendChild( new DOMText( $value ) ); |
|
112 | + if (null !== $value) { |
|
113 | + $element->appendChild(new DOMText($value)); |
|
114 | 114 | } |
115 | 115 | |
116 | - $parent->appendChild( $element ); |
|
116 | + $parent->appendChild($element); |
|
117 | 117 | |
118 | 118 | return $element; |
119 | 119 | } |
@@ -125,15 +125,15 @@ discard block |
||
125 | 125 | * @param DOMNode $parent |
126 | 126 | * @param array $elements |
127 | 127 | */ |
128 | - public static function add_elements( DOMDocument $document, DOMNode $parent, array $elements = array() ) { |
|
129 | - foreach ( $elements as $name => $value ) { |
|
130 | - $element = $document->createElement( $name ); |
|
128 | + public static function add_elements(DOMDocument $document, DOMNode $parent, array $elements = array()) { |
|
129 | + foreach ($elements as $name => $value) { |
|
130 | + $element = $document->createElement($name); |
|
131 | 131 | |
132 | - if ( null !== $value ) { |
|
133 | - $element->appendChild( new DOMText( $value ) ); |
|
132 | + if (null !== $value) { |
|
133 | + $element->appendChild(new DOMText($value)); |
|
134 | 134 | } |
135 | 135 | |
136 | - $parent->appendChild( $element ); |
|
136 | + $parent->appendChild($element); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * Constructs and initialize a directory request message |
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | - parent::__construct( self::NAME ); |
|
26 | + parent::__construct(self::NAME); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | // Merchant |
38 | 38 | $merchant = $this->get_merchant(); |
39 | 39 | |
40 | - $element = self::add_element( $document, $document->documentElement, 'Merchant' ); |
|
41 | - self::add_elements( $document, $element, array( |
|
40 | + $element = self::add_element($document, $document->documentElement, 'Merchant'); |
|
41 | + self::add_elements($document, $element, array( |
|
42 | 42 | 'merchantID' => $merchant->get_id(), |
43 | 43 | 'subID' => $merchant->get_sub_id(), |
44 | - ) ); |
|
44 | + )); |
|
45 | 45 | |
46 | 46 | // Return |
47 | 47 | return $document; |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param string $name |
29 | 29 | */ |
30 | - public function __construct( $name ) { |
|
31 | - parent::__construct( $name ); |
|
30 | + public function __construct($name) { |
|
31 | + parent::__construct($name); |
|
32 | 32 | |
33 | 33 | $this->merchant = new Merchant(); |
34 | 34 | } |
@@ -48,25 +48,25 @@ discard block |
||
48 | 48 | * @return DOMDocument |
49 | 49 | */ |
50 | 50 | public function get_document() { |
51 | - $document = new DOMDocument( parent::XML_VERSION, parent::XML_ENCODING ); |
|
51 | + $document = new DOMDocument(parent::XML_VERSION, parent::XML_ENCODING); |
|
52 | 52 | // We can't disable preservere white space and format the output |
53 | 53 | // this is causing 'Invalid electronic signature' errors |
54 | 54 | // $document->preserveWhiteSpace = true; |
55 | 55 | // $document->formatOutput = true; |
56 | 56 | |
57 | 57 | // Root |
58 | - $root = $document->createElementNS( parent::XML_NAMESPACE, $this->get_name() ); |
|
59 | - $root->setAttribute( 'version', parent::VERSION ); |
|
58 | + $root = $document->createElementNS(parent::XML_NAMESPACE, $this->get_name()); |
|
59 | + $root->setAttribute('version', parent::VERSION); |
|
60 | 60 | |
61 | - $document->appendChild( $root ); |
|
61 | + $document->appendChild($root); |
|
62 | 62 | |
63 | 63 | // Create date timestamp |
64 | 64 | // Using DateTime::ISO8601 won't work, this is giving an error |
65 | - $timestamp = $this->get_create_date()->format( 'Y-m-d\TH:i:s.000\Z' ); |
|
65 | + $timestamp = $this->get_create_date()->format('Y-m-d\TH:i:s.000\Z'); |
|
66 | 66 | |
67 | - $element = $document->createElement( 'createDateTimestamp', $timestamp ); |
|
67 | + $element = $document->createElement('createDateTimestamp', $timestamp); |
|
68 | 68 | |
69 | - $root->appendChild( $element ); |
|
69 | + $root->appendChild($element); |
|
70 | 70 | |
71 | 71 | return $document; |
72 | 72 | } |
@@ -24,16 +24,16 @@ |
||
24 | 24 | * |
25 | 25 | * @return Directory |
26 | 26 | */ |
27 | - public static function parse( SimpleXMLElement $xml ) { |
|
27 | + public static function parse(SimpleXMLElement $xml) { |
|
28 | 28 | $directory = new Directory(); |
29 | 29 | |
30 | - $timestamp = Security::filter( $xml->directoryDateTimestamp ); |
|
31 | - $directory->set_date( new DateTime( $timestamp ) ); |
|
30 | + $timestamp = Security::filter($xml->directoryDateTimestamp); |
|
31 | + $directory->set_date(new DateTime($timestamp)); |
|
32 | 32 | |
33 | - foreach ( $xml->Country as $element ) { |
|
34 | - $country = CountryParser::parse( $element ); |
|
33 | + foreach ($xml->Country as $element) { |
|
34 | + $country = CountryParser::parse($element); |
|
35 | 35 | |
36 | - $directory->add_country( $country ); |
|
36 | + $directory->add_country($country); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return $directory; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * Constructs and initialize an status request message |
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | - parent::__construct( self::NAME ); |
|
36 | + parent::__construct(self::NAME); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | // Merchant |
48 | 48 | $merchant = $this->get_merchant(); |
49 | 49 | |
50 | - $element = self::add_element( $document, $document->documentElement, 'Merchant' ); |
|
51 | - self::add_elements( $document, $element, array( |
|
50 | + $element = self::add_element($document, $document->documentElement, 'Merchant'); |
|
51 | + self::add_elements($document, $element, array( |
|
52 | 52 | 'merchantID' => $merchant->get_id(), |
53 | 53 | 'subID' => $merchant->get_sub_id(), |
54 | - ) ); |
|
54 | + )); |
|
55 | 55 | |
56 | 56 | // Transaction |
57 | 57 | $transaction = $this->transaction; |
58 | 58 | |
59 | - $element = self::add_element( $document, $document->documentElement, 'Transaction' ); |
|
60 | - self::add_element( $document, $element, 'transactionID', $transaction->get_id() ); |
|
59 | + $element = self::add_element($document, $document->documentElement, 'Transaction'); |
|
60 | + self::add_element($document, $element, 'transactionID', $transaction->get_id()); |
|
61 | 61 | |
62 | 62 | // Return |
63 | 63 | return $document; |