@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * @param string $message |
| 21 | 21 | * @param Throwable $previous |
| 22 | 22 | */ |
| 23 | - public function __construct($message, $code=0, \Exception $previous=null) |
|
| 23 | + public function __construct($message, $code = 0, \Exception $previous = null) |
|
| 24 | 24 | { |
| 25 | 25 | parent::__construct($message, $code, $previous, true); |
| 26 | 26 | } |
@@ -21,9 +21,9 @@ |
||
| 21 | 21 | * @param string $message |
| 22 | 22 | * @param Throwable $previous |
| 23 | 23 | */ |
| 24 | - public function __construct($message, $code=0, \Exception $previous=null, $tracelog=false) |
|
| 24 | + public function __construct($message, $code = 0, \Exception $previous = null, $tracelog = false) |
|
| 25 | 25 | { |
| 26 | - Log::instance()->error($message.(($tracelog)?PHP_EOL.$this->getTraceAsString():null)); |
|
| 26 | + Log::instance()->error($message.(($tracelog) ?PHP_EOL.$this->getTraceAsString() : null)); |
|
| 27 | 27 | parent::__construct($message, $code, $previous); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | * @param string $name |
| 42 | 42 | * @param string $value (optional) |
| 43 | 43 | */ |
| 44 | - public function createElement($name, $value=NULL) |
|
| 44 | + public function createElement($name, $value = NULL) |
|
| 45 | 45 | { |
| 46 | 46 | return parent::createElement($name, $value); |
| 47 | 47 | } |
@@ -113,7 +113,9 @@ |
||
| 113 | 113 | */ |
| 114 | 114 | protected function sign($options) |
| 115 | 115 | { |
| 116 | - if (isset($this->Sign)) return; |
|
| 116 | + if (isset($this->Sign)) { |
|
| 117 | + return; |
|
| 118 | + } |
|
| 117 | 119 | |
| 118 | 120 | if (isset($options['UseSign']) && ($options['UseSign'] === true)) |
| 119 | 121 | { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * @var array list of possible operations |
| 41 | 41 | */ |
| 42 | - protected $operations = array('Check','Payment','Confirm','Cancel'); |
|
| 42 | + protected $operations = array('Check', 'Payment', 'Confirm', 'Cancel'); |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * General constructor |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function verify_sign($options) |
| 224 | 224 | { |
| 225 | - if (!isset($options['UseSign']) || ($options['UseSign'] === false)) |
|
| 225 | + if ( ! isset($options['UseSign']) || ($options['UseSign'] === false)) |
|
| 226 | 226 | { |
| 227 | 227 | return null; |
| 228 | 228 | } |
@@ -276,9 +276,9 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | * @return array nodes with the name |
| 278 | 278 | */ |
| 279 | - protected function getNodes($dom, $name, $ret=array()) |
|
| 279 | + protected function getNodes($dom, $name, $ret = array()) |
|
| 280 | 280 | { |
| 281 | - foreach($dom->childNodes as $child) |
|
| 281 | + foreach ($dom->childNodes as $child) |
|
| 282 | 282 | { |
| 283 | 283 | if ($child->nodeName == $name) |
| 284 | 284 | { |
@@ -118,8 +118,7 @@ discard block |
||
| 118 | 118 | if (count($r) > 1) |
| 119 | 119 | { |
| 120 | 120 | throw new Exception\Structure('There is more than one Request element in the xml-query!', -52); |
| 121 | - } |
|
| 122 | - elseif (count($r) < 1) |
|
| 121 | + } elseif (count($r) < 1) |
|
| 123 | 122 | { |
| 124 | 123 | throw new Exception\Structure('The xml-query does not contain any element Request!', -52); |
| 125 | 124 | } |
@@ -129,18 +128,15 @@ discard block |
||
| 129 | 128 | if ($child->nodeName == 'DateTime') |
| 130 | 129 | { |
| 131 | 130 | $this->parse_request_node($child, 'DateTime'); |
| 132 | - } |
|
| 133 | - elseif ($child->nodeName == 'Sign') |
|
| 131 | + } elseif ($child->nodeName == 'Sign') |
|
| 134 | 132 | { |
| 135 | 133 | $this->parse_request_node($child, 'Sign'); |
| 136 | - } |
|
| 137 | - elseif (in_array($child->nodeName, $this->operations)) |
|
| 134 | + } elseif (in_array($child->nodeName, $this->operations)) |
|
| 138 | 135 | { |
| 139 | 136 | if ( ! isset($this->Operation)) |
| 140 | 137 | { |
| 141 | 138 | $this->Operation = $child->nodeName; |
| 142 | - } |
|
| 143 | - else |
|
| 139 | + } else |
|
| 144 | 140 | { |
| 145 | 141 | throw new Exception\Structure('There is more than one Operation type element in the xml-query!', -53); |
| 146 | 142 | } |
@@ -177,8 +173,7 @@ discard block |
||
| 177 | 173 | if ( ! isset($this->$name)) |
| 178 | 174 | { |
| 179 | 175 | $this->$name = $n->nodeValue; |
| 180 | - } |
|
| 181 | - else |
|
| 176 | + } else |
|
| 182 | 177 | { |
| 183 | 178 | throw new Exception\Structure('There is more than one '.$name.' element in the xml-query!', -56); |
| 184 | 179 | } |
@@ -260,8 +255,7 @@ discard block |
||
| 260 | 255 | if ($check == -1) |
| 261 | 256 | { |
| 262 | 257 | throw new Exception\Sign('Error verify signature of request!', -96); |
| 263 | - } |
|
| 264 | - elseif ($check == 0) |
|
| 258 | + } elseif ($check == 0) |
|
| 265 | 259 | { |
| 266 | 260 | throw new Exception\Sign('Signature of request is incorrect!', -95); |
| 267 | 261 | } |
@@ -283,8 +277,7 @@ discard block |
||
| 283 | 277 | if ($child->nodeName == $name) |
| 284 | 278 | { |
| 285 | 279 | array_push($ret, $child); |
| 286 | - } |
|
| 287 | - else |
|
| 280 | + } else |
|
| 288 | 281 | { |
| 289 | 282 | if (count($child->childNodes) > 0) |
| 290 | 283 | { |
@@ -16,35 +16,35 @@ |
||
| 16 | 16 | |
| 17 | 17 | final class Check extends Response |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | + /** |
|
| 20 | 20 | * Check constructor |
| 21 | 21 | * |
| 22 | 22 | * @param AccountInfo $accountinfo account information set |
| 23 | 23 | */ |
| 24 | - function __construct(AccountInfo $accountinfo) { |
|
| 25 | - parent::__construct(); |
|
| 24 | + function __construct(AccountInfo $accountinfo) { |
|
| 25 | + parent::__construct(); |
|
| 26 | 26 | |
| 27 | - $this->setElementValue('StatusCode', 0); |
|
| 28 | - $this->setElementValue('StatusDetail', 'checked'); |
|
| 27 | + $this->setElementValue('StatusCode', 0); |
|
| 28 | + $this->setElementValue('StatusDetail', 'checked'); |
|
| 29 | 29 | |
| 30 | - $this->create_AccountInfo($accountinfo); |
|
| 31 | - } |
|
| 30 | + $this->create_AccountInfo($accountinfo); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | + /** |
|
| 34 | 34 | * Create AccountInfo node with child nodes |
| 35 | 35 | * |
| 36 | 36 | * @param AccountInfo $accountinfo account information set |
| 37 | 37 | */ |
| 38 | - public function create_AccountInfo($accountinfo) |
|
| 39 | - { |
|
| 40 | - if (isset($this->AccountInfo)) return; |
|
| 38 | + public function create_AccountInfo($accountinfo) |
|
| 39 | + { |
|
| 40 | + if (isset($this->AccountInfo)) return; |
|
| 41 | 41 | |
| 42 | - $this->AccountInfo = self::createElement('AccountInfo'); |
|
| 43 | - $this->Response->appendChild($this->AccountInfo); |
|
| 42 | + $this->AccountInfo = self::createElement('AccountInfo'); |
|
| 43 | + $this->Response->appendChild($this->AccountInfo); |
|
| 44 | 44 | |
| 45 | - foreach($accountinfo as $parameter=>$value) |
|
| 46 | - { |
|
| 47 | - $this->AccountInfo->appendChild(self::createElement($parameter, $value)); |
|
| 48 | - } |
|
| 49 | - } |
|
| 45 | + foreach($accountinfo as $parameter=>$value) |
|
| 46 | + { |
|
| 47 | + $this->AccountInfo->appendChild(self::createElement($parameter, $value)); |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | $this->AccountInfo = self::createElement('AccountInfo'); |
| 43 | 43 | $this->Response->appendChild($this->AccountInfo); |
| 44 | 44 | |
| 45 | - foreach($accountinfo as $parameter=>$value) |
|
| 45 | + foreach ($accountinfo as $parameter=>$value) |
|
| 46 | 46 | { |
| 47 | 47 | $this->AccountInfo->appendChild(self::createElement($parameter, $value)); |
| 48 | 48 | } |
@@ -37,7 +37,9 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | public function create_AccountInfo($accountinfo) |
| 39 | 39 | { |
| 40 | - if (isset($this->AccountInfo)) return; |
|
| 40 | + if (isset($this->AccountInfo)) { |
|
| 41 | + return; |
|
| 42 | + } |
|
| 41 | 43 | |
| 42 | 44 | $this->AccountInfo = self::createElement('AccountInfo'); |
| 43 | 45 | $this->Response->appendChild($this->AccountInfo); |
@@ -15,30 +15,30 @@ |
||
| 15 | 15 | |
| 16 | 16 | final class Confirm extends Response |
| 17 | 17 | { |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Confirm constructor |
| 20 | 20 | * |
| 21 | 21 | * @param string $orderdate |
| 22 | 22 | */ |
| 23 | - function __construct($orderdate) { |
|
| 24 | - parent::__construct(); |
|
| 23 | + function __construct($orderdate) { |
|
| 24 | + parent::__construct(); |
|
| 25 | 25 | |
| 26 | - $this->setElementValue('StatusCode', 0); |
|
| 27 | - $this->setElementValue('StatusDetail', 'checked'); |
|
| 26 | + $this->setElementValue('StatusCode', 0); |
|
| 27 | + $this->setElementValue('StatusDetail', 'checked'); |
|
| 28 | 28 | |
| 29 | - $this->create_OrderDate($orderdate); |
|
| 30 | - } |
|
| 29 | + $this->create_OrderDate($orderdate); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 32 | + /** |
|
| 33 | 33 | * Create OrderDate node |
| 34 | 34 | * |
| 35 | 35 | * @param string $orderdate |
| 36 | 36 | */ |
| 37 | - public function create_OrderDate($orderdate) |
|
| 38 | - { |
|
| 39 | - if (isset($this->OrderDate)) return; |
|
| 37 | + public function create_OrderDate($orderdate) |
|
| 38 | + { |
|
| 39 | + if (isset($this->OrderDate)) return; |
|
| 40 | 40 | |
| 41 | - $this->OrderDate = self::createElement('OrderDate', $orderdate); |
|
| 42 | - $this->Response->appendChild($this->OrderDate); |
|
| 43 | - } |
|
| 41 | + $this->OrderDate = self::createElement('OrderDate', $orderdate); |
|
| 42 | + $this->Response->appendChild($this->OrderDate); |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -36,7 +36,9 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | public function create_OrderDate($orderdate) |
| 38 | 38 | { |
| 39 | - if (isset($this->OrderDate)) return; |
|
| 39 | + if (isset($this->OrderDate)) { |
|
| 40 | + return; |
|
| 41 | + } |
|
| 40 | 42 | |
| 41 | 43 | $this->OrderDate = self::createElement('OrderDate', $orderdate); |
| 42 | 44 | $this->Response->appendChild($this->OrderDate); |
@@ -15,30 +15,30 @@ |
||
| 15 | 15 | |
| 16 | 16 | final class Cancel extends Response |
| 17 | 17 | { |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Cancel constructor |
| 20 | 20 | * |
| 21 | 21 | * @param string $orderdate |
| 22 | 22 | */ |
| 23 | - function __construct($canceldate) { |
|
| 24 | - parent::__construct(); |
|
| 23 | + function __construct($canceldate) { |
|
| 24 | + parent::__construct(); |
|
| 25 | 25 | |
| 26 | - $this->setElementValue('StatusCode', 0); |
|
| 27 | - $this->setElementValue('StatusDetail', 'checked'); |
|
| 26 | + $this->setElementValue('StatusCode', 0); |
|
| 27 | + $this->setElementValue('StatusDetail', 'checked'); |
|
| 28 | 28 | |
| 29 | - $this->create_CancelDate($canceldate); |
|
| 30 | - } |
|
| 29 | + $this->create_CancelDate($canceldate); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 32 | + /** |
|
| 33 | 33 | * Create CancelDate node |
| 34 | 34 | * |
| 35 | 35 | * @param string $canceldate |
| 36 | 36 | */ |
| 37 | - public function create_CancelDate($canceldate) |
|
| 38 | - { |
|
| 39 | - if (isset($this->CancelDate)) return; |
|
| 37 | + public function create_CancelDate($canceldate) |
|
| 38 | + { |
|
| 39 | + if (isset($this->CancelDate)) return; |
|
| 40 | 40 | |
| 41 | - $this->CancelDate = self::createElement('CancelDate', $canceldate); |
|
| 42 | - $this->Response->appendChild($this->CancelDate); |
|
| 43 | - } |
|
| 41 | + $this->CancelDate = self::createElement('CancelDate', $canceldate); |
|
| 42 | + $this->Response->appendChild($this->CancelDate); |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -36,7 +36,9 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | public function create_CancelDate($canceldate) |
| 38 | 38 | { |
| 39 | - if (isset($this->CancelDate)) return; |
|
| 39 | + if (isset($this->CancelDate)) { |
|
| 40 | + return; |
|
| 41 | + } |
|
| 40 | 42 | |
| 41 | 43 | $this->CancelDate = self::createElement('CancelDate', $canceldate); |
| 42 | 44 | $this->Response->appendChild($this->CancelDate); |
@@ -15,30 +15,30 @@ |
||
| 15 | 15 | |
| 16 | 16 | final class Payment extends Response |
| 17 | 17 | { |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Payment constructor |
| 20 | 20 | * |
| 21 | 21 | * @param string $paymentid |
| 22 | 22 | */ |
| 23 | - function __construct($paymentid) { |
|
| 24 | - parent::__construct(); |
|
| 23 | + function __construct($paymentid) { |
|
| 24 | + parent::__construct(); |
|
| 25 | 25 | |
| 26 | - $this->setElementValue('StatusCode', 0); |
|
| 27 | - $this->setElementValue('StatusDetail', 'checked'); |
|
| 26 | + $this->setElementValue('StatusCode', 0); |
|
| 27 | + $this->setElementValue('StatusDetail', 'checked'); |
|
| 28 | 28 | |
| 29 | - $this->create_PaymentId($paymentid); |
|
| 30 | - } |
|
| 29 | + $this->create_PaymentId($paymentid); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 32 | + /** |
|
| 33 | 33 | * Create PaymentId node |
| 34 | 34 | * |
| 35 | 35 | * @param string $paymentid |
| 36 | 36 | */ |
| 37 | - public function create_PaymentId($paymentid) |
|
| 38 | - { |
|
| 39 | - if (isset($this->PaymentId)) return; |
|
| 37 | + public function create_PaymentId($paymentid) |
|
| 38 | + { |
|
| 39 | + if (isset($this->PaymentId)) return; |
|
| 40 | 40 | |
| 41 | - $this->PaymentId = self::createElement('PaymentId', $paymentid); |
|
| 42 | - $this->Response->appendChild($this->PaymentId); |
|
| 43 | - } |
|
| 41 | + $this->PaymentId = self::createElement('PaymentId', $paymentid); |
|
| 42 | + $this->Response->appendChild($this->PaymentId); |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -36,7 +36,9 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | public function create_PaymentId($paymentid) |
| 38 | 38 | { |
| 39 | - if (isset($this->PaymentId)) return; |
|
| 39 | + if (isset($this->PaymentId)) { |
|
| 40 | + return; |
|
| 41 | + } |
|
| 40 | 42 | |
| 41 | 43 | $this->PaymentId = self::createElement('PaymentId', $paymentid); |
| 42 | 44 | $this->Response->appendChild($this->PaymentId); |
@@ -15,16 +15,16 @@ |
||
| 15 | 15 | |
| 16 | 16 | final class ErrorInfo extends Response |
| 17 | 17 | { |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * ErrorInfo constructor |
| 20 | 20 | * |
| 21 | 21 | * @param integer $code Error code |
| 22 | 22 | * @param string $message Error message text |
| 23 | 23 | */ |
| 24 | - function __construct($code, $message) { |
|
| 25 | - parent::__construct(); |
|
| 24 | + function __construct($code, $message) { |
|
| 25 | + parent::__construct(); |
|
| 26 | 26 | |
| 27 | - $this->setElementValue('StatusCode', $code); |
|
| 28 | - $this->setElementValue('StatusDetail', $message); |
|
| 29 | - } |
|
| 27 | + $this->setElementValue('StatusCode', $code); |
|
| 28 | + $this->setElementValue('StatusDetail', $message); |
|
| 29 | + } |
|
| 30 | 30 | } |