@@ -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 | { |
@@ -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 | { |
@@ -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); |
@@ -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); |
@@ -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); |
@@ -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); |
@@ -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 | } |