@@ -77,8 +77,9 @@ discard block |
||
| 77 | 77 | $data = $this->_call('GETPAYMENTMETHODS', $parameters, array('Response', 'Response', 'PaymentMethods', 'PaymentMethod')); |
| 78 | 78 | $res = array(); |
| 79 | 79 | foreach($data as $item){ |
| 80 | - if ($item['Active']['value'] == 'Y') |
|
| 81 | - $res[] = array('name'=>$item['Name']['value']); |
|
| 80 | + if ($item['Active']['value'] == 'Y') { |
|
| 81 | + $res[] = array('name'=>$item['Name']['value']); |
|
| 82 | + } |
|
| 82 | 83 | } |
| 83 | 84 | return $res; |
| 84 | 85 | } |
@@ -163,8 +164,7 @@ discard block |
||
| 163 | 164 | public function getPaymentStatus($transactioncode){ |
| 164 | 165 | if ($_GET['checksum'] == sha1($_GET['id'] . $transactioncode . $_GET['status'] . $_GET['salt'])){ |
| 165 | 166 | return $_GET['status'] == '1'; |
| 166 | - } |
|
| 167 | - else{ |
|
| 167 | + } else{ |
|
| 168 | 168 | throw new \Exception('Checksum error'); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -180,12 +180,10 @@ discard block |
||
| 180 | 180 | 'Bank'=> $result['Consumer']['Bank']['value'], |
| 181 | 181 | 'Name'=> $result['Consumer']['Name']['value'] |
| 182 | 182 | ); |
| 183 | - } |
|
| 184 | - else{ |
|
| 183 | + } else{ |
|
| 185 | 184 | $this->_lastcustomer = array(); |
| 186 | 185 | } |
| 187 | - } |
|
| 188 | - else{ |
|
| 186 | + } else{ |
|
| 189 | 187 | $this->_lastcustomer = array(); |
| 190 | 188 | } |
| 191 | 189 | |
@@ -292,38 +290,33 @@ discard block |
||
| 292 | 290 | |
| 293 | 291 | if (isset($result['Response']['Response']) && isset($result['Response']['Response']['Code'])){ |
| 294 | 292 | $this->_transaction_code = $result['Response']['Response']['Code']['value']; |
| 295 | - } |
|
| 296 | - else{ |
|
| 293 | + } else{ |
|
| 297 | 294 | $this->_transaction_code = null; |
| 298 | 295 | } |
| 299 | 296 | |
| 300 | 297 | if (isset($result['Response']['Response']) && isset($result['Response']['Response']['TransactionID'])){ |
| 301 | 298 | $this->_transaction_id = $result['Response']['Response']['TransactionID']['value']; |
| 302 | - } |
|
| 303 | - else{ |
|
| 299 | + } else{ |
|
| 304 | 300 | $this->_transaction_id = null; |
| 305 | 301 | } |
| 306 | 302 | $pnt = $result; |
| 307 | 303 | foreach($look_for as $item){ |
| 308 | 304 | if (isset($pnt[$item])){ |
| 309 | 305 | $pnt = $pnt[$item]; |
| 310 | - } |
|
| 311 | - else{ |
|
| 306 | + } else{ |
|
| 312 | 307 | return true; |
| 313 | 308 | } |
| 314 | 309 | } |
| 315 | 310 | return $pnt; |
| 316 | 311 | |
| 317 | - } |
|
| 318 | - else{ |
|
| 312 | + } else{ |
|
| 319 | 313 | |
| 320 | 314 | if (isset($result['Response']) && isset($result['Response']['Status'])){ |
| 321 | 315 | $this->xml_in = $returndata; |
| 322 | 316 | $this->xml_out = $xml; |
| 323 | 317 | $this->_last_error = $result['Response']['Error']['Description']['value']; |
| 324 | 318 | $this->_last_error_id = $result['Response']['Error']['ID']['value']; |
| 325 | - } |
|
| 326 | - else{ |
|
| 319 | + } else{ |
|
| 327 | 320 | $this->xml_in = $returndata; |
| 328 | 321 | $this->xml_out = $xml; |
| 329 | 322 | $this->_last_error = 'Invalid response from server'; |
@@ -378,8 +371,9 @@ discard block |
||
| 378 | 371 | |
| 379 | 372 | foreach($data as $k=>$v){ |
| 380 | 373 | $xml .= str_repeat("\t", $level); |
| 381 | - if (preg_match('/^(.+)\.(\d+)$/', $k, $matches)) |
|
| 382 | - $k = $matches[1]; |
|
| 374 | + if (preg_match('/^(.+)\.(\d+)$/', $k, $matches)) { |
|
| 375 | + $k = $matches[1]; |
|
| 376 | + } |
|
| 383 | 377 | $xml .= '<' . $k; |
| 384 | 378 | $children = array(); |
| 385 | 379 | if (is_array($v)){ |
@@ -394,12 +388,10 @@ discard block |
||
| 394 | 388 | $xml .= '>' . "\n"; |
| 395 | 389 | $xml .= self::_encodeXML($v, $level+1); |
| 396 | 390 | $xml .= str_repeat("\t", $level) . '</' . $k . '>' . "\n"; |
| 397 | - } |
|
| 398 | - else{ |
|
| 391 | + } else{ |
|
| 399 | 392 | if ($v){ |
| 400 | 393 | $xml .= '>' . htmlentities($v) . '</' . $k . '>' . "\n"; |
| 401 | - } |
|
| 402 | - else{ |
|
| 394 | + } else{ |
|
| 403 | 395 | $xml .= ' />' . "\n"; |
| 404 | 396 | } |
| 405 | 397 | } |
@@ -409,7 +401,9 @@ discard block |
||
| 409 | 401 | } |
| 410 | 402 | |
| 411 | 403 | private function _decodeXML($contents){ |
| 412 | - if(!$contents) return array(); |
|
| 404 | + if(!$contents) { |
|
| 405 | + return array(); |
|
| 406 | + } |
|
| 413 | 407 | $priority = ''; |
| 414 | 408 | |
| 415 | 409 | if(!function_exists('xml_parser_create')) { |
@@ -423,7 +417,9 @@ discard block |
||
| 423 | 417 | xml_parse_into_struct($parser, trim($contents), $xml_values); |
| 424 | 418 | xml_parser_free($parser); |
| 425 | 419 | |
| 426 | - if(!$xml_values) return; |
|
| 420 | + if(!$xml_values) { |
|
| 421 | + return; |
|
| 422 | + } |
|
| 427 | 423 | |
| 428 | 424 | |
| 429 | 425 | $xml_array = array(); |
@@ -444,15 +440,21 @@ discard block |
||
| 444 | 440 | $attributes_data = array(); |
| 445 | 441 | |
| 446 | 442 | if(isset($value)) { |
| 447 | - if($priority == 'tag') $result = $value; |
|
| 448 | - else $result['value'] = $value; |
|
| 443 | + if($priority == 'tag') { |
|
| 444 | + $result = $value; |
|
| 445 | + } else { |
|
| 446 | + $result['value'] = $value; |
|
| 447 | + } |
|
| 449 | 448 | } |
| 450 | 449 | |
| 451 | 450 | |
| 452 | 451 | if(isset($attributes) and $get_attributes) { |
| 453 | 452 | foreach($attributes as $attr => $val) { |
| 454 | - if($priority == 'tag') $attributes_data[$attr] = $val; |
|
| 455 | - else $result['attr'][$attr] = $val; |
|
| 453 | + if($priority == 'tag') { |
|
| 454 | + $attributes_data[$attr] = $val; |
|
| 455 | + } else { |
|
| 456 | + $result['attr'][$attr] = $val; |
|
| 457 | + } |
|
| 456 | 458 | } |
| 457 | 459 | } |
| 458 | 460 | |
@@ -461,7 +463,9 @@ discard block |
||
| 461 | 463 | $parent[$level-1] = &$current; |
| 462 | 464 | if(!is_array($current) or (!in_array($tag, array_keys($current)))) { |
| 463 | 465 | $current[$tag] = $result; |
| 464 | - if($attributes_data) $current[$tag. '_attr'] = $attributes_data; |
|
| 466 | + if($attributes_data) { |
|
| 467 | + $current[$tag. '_attr'] = $attributes_data; |
|
| 468 | + } |
|
| 465 | 469 | $repeated_tag_index[$tag.'_'.$level] = 1; |
| 466 | 470 | |
| 467 | 471 | $current = &$current[$tag]; |
@@ -489,7 +493,9 @@ discard block |
||
| 489 | 493 | if(!isset($current[$tag])) { |
| 490 | 494 | $current[$tag] = $result; |
| 491 | 495 | $repeated_tag_index[$tag.'_'.$level] = 1; |
| 492 | - if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data; |
|
| 496 | + if($priority == 'tag' and $attributes_data) { |
|
| 497 | + $current[$tag. '_attr'] = $attributes_data; |
|
| 498 | + } |
|
| 493 | 499 | |
| 494 | 500 | } else { |
| 495 | 501 | if(isset($current[$tag][0]) and is_array($current[$tag])) { |