@@ -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 | { |
@@ -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 | } |
@@ -71,7 +71,7 @@ |
||
71 | 71 | */ |
72 | 72 | private static function get_http_raw_post_data() |
73 | 73 | { |
74 | - Log::instance()->add('request from ' . $_SERVER['REMOTE_ADDR']); |
|
74 | + Log::instance()->add('request from '.$_SERVER['REMOTE_ADDR']); |
|
75 | 75 | |
76 | 76 | $raw_request = file_get_contents('php://input'); |
77 | 77 |
@@ -70,20 +70,16 @@ |
||
70 | 70 | $this->response = $this->get_response(); |
71 | 71 | |
72 | 72 | Log::instance()->add('the request was processed successfully'); |
73 | - } |
|
74 | - catch (Exception\Structure $e) |
|
73 | + } catch (Exception\Structure $e) |
|
75 | 74 | { |
76 | 75 | $this->response = $this->get_error_response($e->getCode(), 'Error in request'); |
77 | - } |
|
78 | - catch (Exception\Sign $e) |
|
76 | + } catch (Exception\Sign $e) |
|
79 | 77 | { |
80 | 78 | $this->response = $this->get_error_response($e->getCode(), 'Signature error!'); |
81 | - } |
|
82 | - catch (Exception\Runtime $e) |
|
79 | + } catch (Exception\Runtime $e) |
|
83 | 80 | { |
84 | 81 | $this->response = $this->get_error_response($e->getCode(), 'Error while processing request'); |
85 | - } |
|
86 | - catch (\Exception $e) |
|
82 | + } catch (\Exception $e) |
|
87 | 83 | { |
88 | 84 | $this->response = $this->get_error_response($e->getCode(), $e->getMessage()); |
89 | 85 | } |
@@ -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 | } |