Completed
Push — master ( 4e37a8...5a2bba )
by Wessel
06:21
created
Providers/EasyIdeal.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -46,6 +46,9 @@  discard block
 block discarded – undo
46 46
         return $res;
47 47
     }
48 48
 
49
+    /**
50
+     * @return string
51
+     */
49 52
     public function Ideal_execute($parameters){
50 53
         $this->_mandatory($parameters, array('Amount', 'Currency', 'Description', 'Bank', 'Return'));
51 54
         return $this->_call('IDEAL.EXECUTE', $parameters, array('Response', 'Response', 'BankURL', 'value'));
@@ -229,6 +232,9 @@  discard block
 block discarded – undo
229 232
 
230 233
     static public $debug = false;
231 234
 
235
+    /**
236
+     * @param string $function
237
+     */
232 238
     private function _call($function, $parameters, $look_for=array()){
233 239
 
234 240
         $this->_last_error = '';
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     static public $endpoint = 'https://www.qantanipayments.com/api/';
18 18
     static public $version = '1.2.3';
19 19
 
20
-    static public function CreateInstance($merchant_id, $merchant_key, $merchant_secret){
20
+    static public function CreateInstance($merchant_id, $merchant_key, $merchant_secret) {
21 21
 
22 22
         $instance = new self();
23 23
 
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
         return $instance;
29 29
     }
30 30
 
31
-    public function CC_Execute($parameters){
31
+    public function CC_Execute($parameters) {
32 32
         $this->_mandatory($parameters, array('Amount', 'Currency', 'Description', 'Return'));
33 33
         return $this->_call('CC.EXECUTE', $parameters, array('Response', 'Response', 'BankURL', 'value'));
34 34
     }
35 35
 
36
-    public function Ideal_getBanks($parameters = array()){
36
+    public function Ideal_getBanks($parameters = array()) {
37 37
         $this->_mandatory($parameters, array());
38
-        $data= $this->_call('IDEAL.GETBANKS', $parameters, array('Response', 'Banks', 'Bank'));
38
+        $data = $this->_call('IDEAL.GETBANKS', $parameters, array('Response', 'Banks', 'Bank'));
39 39
         $res = array();
40
-        foreach($data as $item){
40
+        foreach ($data as $item) {
41 41
             $res[] = array(
42 42
                 'Name'=>$item['Name']['value'],
43 43
                 'Id'=>$item['Id']['value']
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
         return $res;
47 47
     }
48 48
 
49
-    public function Ideal_execute($parameters){
49
+    public function Ideal_execute($parameters) {
50 50
         $this->_mandatory($parameters, array('Amount', 'Currency', 'Description', 'Bank', 'Return'));
51 51
         return $this->_call('IDEAL.EXECUTE', $parameters, array('Response', 'Response', 'BankURL', 'value'));
52 52
     }
53 53
 
54
-    public function paylater_execute($parameters){
54
+    public function paylater_execute($parameters) {
55 55
         $this->_mandatory($parameters, array('Amount', 'Currency', 'Description'));
56 56
 
57
-        if (count($this->_products) == 0){
57
+        if (count($this->_products) == 0) {
58 58
             // no product info
59 59
             throw new \Exception('You have not defined any products. Please call $qantani->addProduct()');
60 60
         }
61
-        if (count($this->_customer) == 0){
61
+        if (count($this->_customer) == 0) {
62 62
             // no customer info
63 63
             throw new \Exception('You have not defined a customer. Please call $qantani->addCustomer()');
64 64
         }
@@ -66,34 +66,34 @@  discard block
 block discarded – undo
66 66
         return $this->_call('PAYLATER.EXECUTE', $parameters, array('Response', 'Status', 'value'));
67 67
     }
68 68
 
69
-    public function bitpay_execute($parameters){
69
+    public function bitpay_execute($parameters) {
70 70
         $this->_mandatory($parameters, array('Amount', 'Currency', 'Description'));
71 71
         return $this->_call('BITPAY.EXECUTE', $parameters, array('Response', 'Response', 'BankURL', 'value'));
72 72
     }
73 73
 
74 74
 
75
-    public function GetPaymentMethods($parameters = array()){
75
+    public function GetPaymentMethods($parameters = array()) {
76 76
         $this->_mandatory($parameters, array());
77 77
         $data = $this->_call('GETPAYMENTMETHODS', $parameters, array('Response', 'Response', 'PaymentMethods', 'PaymentMethod'));
78 78
         $res = array();
79
-        foreach($data as $item){
79
+        foreach ($data as $item) {
80 80
             if ($item['Active']['value'] == 'Y')
81 81
                 $res[] = array('name'=>$item['Name']['value']);
82 82
         }
83 83
         return $res;
84 84
     }
85 85
 
86
-    public function Paypal_execute($parameters = array()){
86
+    public function Paypal_execute($parameters = array()) {
87 87
         $this->_mandatory($parameters, array('Amount', 'Currency', 'Description', 'Return'));
88 88
         return $this->_call('PAYPAL.EXECUTE', $parameters, array('Response', 'Response', 'BankURL', 'value'));
89 89
     }
90 90
 
91
-    public function Sofort_execute($parameters = array()){
91
+    public function Sofort_execute($parameters = array()) {
92 92
         $this->_mandatory($parameters, array('Amount', 'Currency', 'Description', 'Return'));
93 93
         return $this->_call('SOFORT.EXECUTE', $parameters, array('Response', 'Response', 'BankURL', 'value'));
94 94
     }
95 95
 
96
-    public function AddProduct($id, $description, $amount, $price, $currency='EUR', $vat_percentage=21){
96
+    public function AddProduct($id, $description, $amount, $price, $currency = 'EUR', $vat_percentage = 21) {
97 97
         $this->_products[] = array(
98 98
             'ID'=>$id,
99 99
             'Description'=>$description,
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         );
105 105
     }
106 106
 
107
-    public function AddCustomer($type, $id, $companyname, $chamberofcommerce, $firstname, $familyname, $gender, $street, $housenumber, $houseextension, $postalcode, $city, $birthdate, $email, $phonenumber, $ip){
107
+    public function AddCustomer($type, $id, $companyname, $chamberofcommerce, $firstname, $familyname, $gender, $street, $housenumber, $houseextension, $postalcode, $city, $birthdate, $email, $phonenumber, $ip) {
108 108
 
109 109
         $this->_customer = array(
110 110
 
@@ -131,83 +131,83 @@  discard block
 block discarded – undo
131 131
 
132 132
     }
133 133
 
134
-    public function GetLastError(){
134
+    public function GetLastError() {
135 135
         return $this->_last_error;
136 136
     }
137 137
 
138
-    public function GetLastErrorId(){
138
+    public function GetLastErrorId() {
139 139
         return $this->_last_error_id;
140 140
     }
141 141
 
142
-    public function getLastCustomer(){
142
+    public function getLastCustomer() {
143 143
 
144 144
         return $this->_lastcustomer;
145 145
 
146 146
     }
147 147
 
148
-    public function GetLastTransactionCode(){
149
-        if (!$this->_transaction_code){
148
+    public function GetLastTransactionCode() {
149
+        if ( ! $this->_transaction_code) {
150 150
             throw new \Exception('No transaction code received');
151 151
         }
152 152
         return $this->_transaction_code;
153 153
     }
154 154
 
155
-    public function GetLastTransactionId(){
156
-        if (!$this->_transaction_id){
155
+    public function GetLastTransactionId() {
156
+        if ( ! $this->_transaction_id) {
157 157
             throw new \Exception('No transaction id received');
158 158
         }
159 159
         return $this->_transaction_id;
160 160
     }
161 161
 
162 162
 
163
-    public function getPaymentStatus($transactioncode){
164
-        if ($_GET['checksum'] == sha1($_GET['id'] . $transactioncode . $_GET['status'] . $_GET['salt'])){
163
+    public function getPaymentStatus($transactioncode) {
164
+        if ($_GET['checksum'] == sha1($_GET['id'].$transactioncode.$_GET['status'].$_GET['salt'])) {
165 165
             return $_GET['status'] == '1';
166 166
         }
167
-        else{
167
+        else {
168 168
             throw new \Exception('Checksum error');
169 169
         }
170 170
     }
171 171
 
172
-    public function getTransactionStatus($parameters){
172
+    public function getTransactionStatus($parameters) {
173 173
         $this->_mandatory($parameters, array('TransactionID', 'TransactionCode'));
174 174
         $result = $this->_call('TRANSACTIONSTATUS', $parameters, array('Response', 'Transaction'));
175 175
 
176
-        if ($result && count($result)){
177
-            if (isset($result['Consumer']) && isset($result['Consumer']['IBAN']) && isset($result['Consumer']['IBAN']['value'])){
176
+        if ($result && count($result)) {
177
+            if (isset($result['Consumer']) && isset($result['Consumer']['IBAN']) && isset($result['Consumer']['IBAN']['value'])) {
178 178
                 $this->_lastcustomer = array(
179 179
                     'Iban'=> $result['Consumer']['IBAN']['value'],
180 180
                     'Bank'=> $result['Consumer']['Bank']['value'],
181 181
                     'Name'=> $result['Consumer']['Name']['value']
182 182
                 );
183 183
             }
184
-            else{
184
+            else {
185 185
                 $this->_lastcustomer = array();
186 186
             }
187 187
         }
188
-        else{
188
+        else {
189 189
             $this->_lastcustomer = array();
190 190
         }
191 191
 
192 192
         return $result['Paid']['value'] == 'Y';
193 193
     }
194 194
 
195
-    public function CC_Direct($parameters){
195
+    public function CC_Direct($parameters) {
196 196
         $this->_mandatory($parameters, array('Amount', 'Currency', 'Description', 'Brand', 'Number', 'Expiry', 'Verification', 'Holder'));
197 197
         return $this->_call('CC.DIRECT', $parameters, array('Response', 'Response', 'TransactionID', 'value'));
198 198
     }
199 199
 
200
-    public function CC_direct_internal($parameters){
200
+    public function CC_direct_internal($parameters) {
201 201
         $this->_mandatory($parameters, array('Amount', 'Currency', 'TransactionID', 'Brand', 'Number', 'Expiry', 'Verification', 'Holder'));
202 202
         return $this->_call('CC.DIRECT.INTERNAL', $parameters, array('Response', 'Response', 'TransactionID', 'value'));
203 203
     }
204 204
 
205
-    public function register_callback($parameters){
205
+    public function register_callback($parameters) {
206 206
         $this->_mandatory($parameters, array('TransactionID', 'Success', 'Failure'));
207 207
         return $this->_call('REGISTER_CALLBACK', $parameters, array('Response', 'Status', 'value'));
208 208
     }
209 209
 
210
-    public function cancel_callback($parameters){
210
+    public function cancel_callback($parameters) {
211 211
         $this->_mandatory($parameters, array('TransactionID'));
212 212
         return $this->_call('CANCEL_CALLBACK', $parameters, array('Response', 'Status', 'value'));
213 213
     }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
     static public $debug = false;
231 231
 
232
-    private function _call($function, $parameters, $look_for=array()){
232
+    private function _call($function, $parameters, $look_for = array()) {
233 233
 
234 234
         $this->_last_error = '';
235 235
         $this->_last_error_id = 0;
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
             )
251 251
         );
252 252
 
253
-        if (count($this->_products)){
253
+        if (count($this->_products)) {
254 254
             $data['Transaction']['Products'] = array();
255
-            foreach($this->_products as $index=>$product){
256
-                $data['Transaction']['Products']['Product.' . $index] = $product;
255
+            foreach ($this->_products as $index=>$product) {
256
+                $data['Transaction']['Products']['Product.'.$index] = $product;
257 257
             }
258 258
         }
259 259
 
260
-        if (count($this->_customer)){
260
+        if (count($this->_customer)) {
261 261
             $data['Transaction']['Customer'] = $this->_customer;
262 262
         }
263 263
 
264 264
         $xml = self::_encodeXML($data);
265 265
 
266
-        if (self::$debug){
266
+        if (self::$debug) {
267 267
             echo '<strong>XML out:</strong>';
268 268
             echo '<pre>';
269 269
             echo str_replace('<', '&lt;', $xml);
@@ -274,13 +274,13 @@  discard block
 block discarded – undo
274 274
         curl_setopt($ch, CURLOPT_VERBOSE, true);
275 275
         curl_setopt($ch, CURLOPT_URL, self::$endpoint);
276 276
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //  todo: get from server class
277
-        curl_setopt ($ch, CURLOPT_POST, true);
278
-        curl_setopt ($ch, CURLOPT_POSTFIELDS, 'data=' . urlencode($xml));
279
-        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
277
+        curl_setopt($ch, CURLOPT_POST, true);
278
+        curl_setopt($ch, CURLOPT_POSTFIELDS, 'data='.urlencode($xml));
279
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
280 280
 
281 281
         $returndata = curl_exec($ch);
282 282
 
283
-        if (self::$debug){
283
+        if (self::$debug) {
284 284
             echo '<strong>XML in:</strong>';
285 285
             echo '<pre>';
286 286
             echo str_replace('<', '&lt;', $returndata);
@@ -288,42 +288,42 @@  discard block
 block discarded – undo
288 288
         }
289 289
 
290 290
         $result = self::_decodexml($returndata);
291
-        if (isset($result['Response']) && isset($result['Response']['Status']) && $result['Response']['Status']['value'] == 'OK'){
291
+        if (isset($result['Response']) && isset($result['Response']['Status']) && $result['Response']['Status']['value'] == 'OK') {
292 292
 
293
-            if (isset($result['Response']['Response']) && isset($result['Response']['Response']['Code'])){
293
+            if (isset($result['Response']['Response']) && isset($result['Response']['Response']['Code'])) {
294 294
                 $this->_transaction_code = $result['Response']['Response']['Code']['value'];
295 295
             }
296
-            else{
296
+            else {
297 297
                 $this->_transaction_code = null;
298 298
             }
299 299
 
300
-            if (isset($result['Response']['Response']) && isset($result['Response']['Response']['TransactionID'])){
300
+            if (isset($result['Response']['Response']) && isset($result['Response']['Response']['TransactionID'])) {
301 301
                 $this->_transaction_id = $result['Response']['Response']['TransactionID']['value'];
302 302
             }
303
-            else{
303
+            else {
304 304
                 $this->_transaction_id = null;
305 305
             }
306 306
             $pnt = $result;
307
-            foreach($look_for as $item){
308
-                if (isset($pnt[$item])){
307
+            foreach ($look_for as $item) {
308
+                if (isset($pnt[$item])) {
309 309
                     $pnt = $pnt[$item];
310 310
                 }
311
-                else{
311
+                else {
312 312
                     return true;
313 313
                 }
314 314
             }
315 315
             return $pnt;
316 316
 
317 317
         }
318
-        else{
318
+        else {
319 319
 
320
-            if (isset($result['Response']) && isset($result['Response']['Status'])){
320
+            if (isset($result['Response']) && isset($result['Response']['Status'])) {
321 321
                 $this->xml_in = $returndata;
322 322
                 $this->xml_out = $xml;
323 323
                 $this->_last_error = $result['Response']['Error']['Description']['value'];
324 324
                 $this->_last_error_id = $result['Response']['Error']['ID']['value'];
325 325
             }
326
-            else{
326
+            else {
327 327
                 $this->xml_in = $returndata;
328 328
                 $this->xml_out = $xml;
329 329
                 $this->_last_error = 'Invalid response from server';
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 
336 336
     }
337 337
 
338
-    private function _generateChecksum($par){
338
+    private function _generateChecksum($par) {
339 339
         ksort($par);
340 340
         $checksum = '';
341
-        foreach($par as $k=>$v){
341
+        foreach ($par as $k=>$v) {
342 342
             $checksum .= $v;
343 343
         }
344 344
 
@@ -346,61 +346,61 @@  discard block
 block discarded – undo
346 346
 
347 347
 
348 348
         // insert products
349
-        if (count($this->_products)){
350
-            foreach($this->_products as $index=>$product){
351
-                $lines[] .= $product['Amount'] . $product['Currency'] . $product['Description'] . $product['ID'] . $product['Price'] . $product['Vat'];
349
+        if (count($this->_products)) {
350
+            foreach ($this->_products as $index=>$product) {
351
+                $lines[] .= $product['Amount'].$product['Currency'].$product['Description'].$product['ID'].$product['Price'].$product['Vat'];
352 352
             }
353 353
         }
354 354
 
355 355
         // insert customer
356
-        if (count($this->_customer)){
356
+        if (count($this->_customer)) {
357 357
             ksort($this->_customer);
358 358
             $line = '';
359
-            foreach($this->_customer as $v){
359
+            foreach ($this->_customer as $v) {
360 360
                 $line .= $v;
361 361
             }
362 362
             $lines[] = $line;
363 363
         }
364 364
 
365
-        return sha1($checksum . implode('', $lines) . $this->_merchant_secret);
365
+        return sha1($checksum.implode('', $lines).$this->_merchant_secret);
366 366
     }
367 367
 
368
-    private function _mandatory($parameters, $mandatory){
369
-        foreach($mandatory as $item){
370
-            if (!isset($parameters[$item])){
371
-                throw new \Exception($item . ' has not been set');
368
+    private function _mandatory($parameters, $mandatory) {
369
+        foreach ($mandatory as $item) {
370
+            if ( ! isset($parameters[$item])) {
371
+                throw new \Exception($item.' has not been set');
372 372
             }
373 373
         }
374 374
     }
375 375
 
376
-    private function _encodeXML($data, $level=0){
377
-        $xml = ($level == 0) ? '<?xml version="1.0" encoding="UTF-8"?' .'>' . "\n" : '';
376
+    private function _encodeXML($data, $level = 0) {
377
+        $xml = ($level == 0) ? '<?xml version="1.0" encoding="UTF-8"?'.'>'."\n" : '';
378 378
 
379
-        foreach($data as $k=>$v){
379
+        foreach ($data as $k=>$v) {
380 380
             $xml .= str_repeat("\t", $level);
381 381
             if (preg_match('/^(.+)\.(\d+)$/', $k, $matches))
382 382
                 $k = $matches[1];
383
-            $xml .= '<' . $k;
383
+            $xml .= '<'.$k;
384 384
             $children = array();
385
-            if (is_array($v)){
386
-                foreach($v as $k2=>$v2){
387
-                    if (substr($k2, 0, 5) == 'attr:'){
388
-                        $xml .= ' ' . substr($k2,5) . '="' . $v2 . '"';
385
+            if (is_array($v)) {
386
+                foreach ($v as $k2=>$v2) {
387
+                    if (substr($k2, 0, 5) == 'attr:') {
388
+                        $xml .= ' '.substr($k2, 5).'="'.$v2.'"';
389 389
                         unset($v[$k2]);
390 390
                     }
391 391
                 }
392 392
             }
393
-            if (is_array($v) && count($v)){
394
-                $xml .= '>' . "\n";
395
-                $xml .= self::_encodeXML($v, $level+1);
396
-                $xml .= str_repeat("\t", $level) . '</' . $k . '>' . "\n";
393
+            if (is_array($v) && count($v)) {
394
+                $xml .= '>'."\n";
395
+                $xml .= self::_encodeXML($v, $level + 1);
396
+                $xml .= str_repeat("\t", $level).'</'.$k.'>'."\n";
397 397
             }
398
-            else{
399
-                if ($v){
400
-                    $xml .= '>' . htmlentities($v) . '</' . $k . '>' . "\n";
398
+            else {
399
+                if ($v) {
400
+                    $xml .= '>'.htmlentities($v).'</'.$k.'>'."\n";
401 401
                 }
402
-                else{
403
-                    $xml .= ' />' . "\n";
402
+                else {
403
+                    $xml .= ' />'."\n";
404 404
                 }
405 405
             }
406 406
 
@@ -408,11 +408,11 @@  discard block
 block discarded – undo
408 408
         return $xml;
409 409
     }
410 410
 
411
-    private function _decodeXML($contents){
412
-        if(!$contents) return array();
411
+    private function _decodeXML($contents) {
412
+        if ( ! $contents) return array();
413 413
         $priority = '';
414 414
 
415
-        if(!function_exists('xml_parser_create')) {
415
+        if ( ! function_exists('xml_parser_create')) {
416 416
             return array();
417 417
         }
418 418
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         xml_parse_into_struct($parser, trim($contents), $xml_values);
424 424
         xml_parser_free($parser);
425 425
 
426
-        if(!$xml_values) return;
426
+        if ( ! $xml_values) return;
427 427
 
428 428
 
429 429
         $xml_array = array();
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
         $current = &$xml_array;
435 435
 
436 436
         $repeated_tag_index = array();
437
-        foreach($xml_values as $data) {
438
-            unset($attributes,$value);
437
+        foreach ($xml_values as $data) {
438
+            unset($attributes, $value);
439 439
 
440 440
 
441 441
             extract($data);
@@ -443,84 +443,84 @@  discard block
 block discarded – undo
443 443
             $result = array();
444 444
             $attributes_data = array();
445 445
 
446
-            if(isset($value)) {
447
-                if($priority == 'tag') $result = $value;
446
+            if (isset($value)) {
447
+                if ($priority == 'tag') $result = $value;
448 448
                 else $result['value'] = $value;
449 449
             }
450 450
 
451 451
 
452
-            if(isset($attributes) and $get_attributes) {
453
-                foreach($attributes as $attr => $val) {
454
-                    if($priority == 'tag') $attributes_data[$attr] = $val;
452
+            if (isset($attributes) and $get_attributes) {
453
+                foreach ($attributes as $attr => $val) {
454
+                    if ($priority == 'tag') $attributes_data[$attr] = $val;
455 455
                     else $result['attr'][$attr] = $val;
456 456
                 }
457 457
             }
458 458
 
459 459
 
460
-            if($type == "open") {
461
-                $parent[$level-1] = &$current;
462
-                if(!is_array($current) or (!in_array($tag, array_keys($current)))) {
460
+            if ($type == "open") {
461
+                $parent[$level - 1] = &$current;
462
+                if ( ! is_array($current) or ( ! in_array($tag, array_keys($current)))) {
463 463
                     $current[$tag] = $result;
464
-                    if($attributes_data) $current[$tag. '_attr'] = $attributes_data;
464
+                    if ($attributes_data) $current[$tag.'_attr'] = $attributes_data;
465 465
                     $repeated_tag_index[$tag.'_'.$level] = 1;
466 466
 
467 467
                     $current = &$current[$tag];
468 468
 
469 469
                 } else {
470
-                    if(isset($current[$tag][0])) {
470
+                    if (isset($current[$tag][0])) {
471 471
                         $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
472 472
                         $repeated_tag_index[$tag.'_'.$level]++;
473 473
                     } else {
474
-                        $current[$tag] = array($current[$tag],$result);
474
+                        $current[$tag] = array($current[$tag], $result);
475 475
                         $repeated_tag_index[$tag.'_'.$level] = 2;
476 476
 
477
-                        if(isset($current[$tag.'_attr'])) {
477
+                        if (isset($current[$tag.'_attr'])) {
478 478
                             $current[$tag]['0_attr'] = $current[$tag.'_attr'];
479 479
                             unset($current[$tag.'_attr']);
480 480
                         }
481 481
 
482 482
                     }
483
-                    $last_item_index = $repeated_tag_index[$tag.'_'.$level]-1;
483
+                    $last_item_index = $repeated_tag_index[$tag.'_'.$level] - 1;
484 484
                     $current = &$current[$tag][$last_item_index];
485 485
                 }
486 486
 
487
-            } elseif($type == "complete") {
487
+            } elseif ($type == "complete") {
488 488
 
489
-                if(!isset($current[$tag])) {
489
+                if ( ! isset($current[$tag])) {
490 490
                     $current[$tag] = $result;
491 491
                     $repeated_tag_index[$tag.'_'.$level] = 1;
492
-                    if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data;
492
+                    if ($priority == 'tag' and $attributes_data) $current[$tag.'_attr'] = $attributes_data;
493 493
 
494 494
                 } else {
495
-                    if(isset($current[$tag][0]) and is_array($current[$tag])) {
495
+                    if (isset($current[$tag][0]) and is_array($current[$tag])) {
496 496
 
497 497
                         $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
498 498
 
499
-                        if($priority == 'tag' and $get_attributes and $attributes_data) {
500
-                            $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
499
+                        if ($priority == 'tag' and $get_attributes and $attributes_data) {
500
+                            $current[$tag][$repeated_tag_index[$tag.'_'.$level].'_attr'] = $attributes_data;
501 501
                         }
502 502
                         $repeated_tag_index[$tag.'_'.$level]++;
503 503
 
504 504
                     } else {
505
-                        $current[$tag] = array($current[$tag],$result);
505
+                        $current[$tag] = array($current[$tag], $result);
506 506
                         $repeated_tag_index[$tag.'_'.$level] = 1;
507
-                        if($priority == 'tag' and $get_attributes) {
508
-                            if(isset($current[$tag.'_attr'])) {
507
+                        if ($priority == 'tag' and $get_attributes) {
508
+                            if (isset($current[$tag.'_attr'])) {
509 509
 
510 510
                                 $current[$tag]['0_attr'] = $current[$tag.'_attr'];
511 511
                                 unset($current[$tag.'_attr']);
512 512
                             }
513 513
 
514
-                            if($attributes_data) {
515
-                                $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
514
+                            if ($attributes_data) {
515
+                                $current[$tag][$repeated_tag_index[$tag.'_'.$level].'_attr'] = $attributes_data;
516 516
                             }
517 517
                         }
518 518
                         $repeated_tag_index[$tag.'_'.$level]++;
519 519
                     }
520 520
                 }
521 521
 
522
-            } elseif($type == 'close') {
523
-                $current = &$parent[$level-1];
522
+            } elseif ($type == 'close') {
523
+                $current = &$parent[$level - 1];
524 524
             }
525 525
         }
526 526
 
Please login to merge, or discard this patch.
Braces   +38 added lines, -32 removed lines patch added patch discarded remove patch
@@ -77,8 +77,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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])) {
Please login to merge, or discard this patch.
Driver/EasyIDealDriver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,6 +105,6 @@
 block discarded – undo
105 105
      */
106 106
     private function getFile()
107 107
     {
108
-        return sys_get_temp_dir() . DIRECTORY_SEPARATOR . session_id();
108
+        return sys_get_temp_dir().DIRECTORY_SEPARATOR.session_id();
109 109
     }
110 110
 }
Please login to merge, or discard this patch.
Driver/MollieDriver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,6 +88,6 @@
 block discarded – undo
88 88
      */
89 89
     private function getFile()
90 90
     {
91
-        return sys_get_temp_dir() . DIRECTORY_SEPARATOR . session_id();
91
+        return sys_get_temp_dir().DIRECTORY_SEPARATOR.session_id();
92 92
     }
93 93
 }
Please login to merge, or discard this patch.