Passed
Pull Request — master (#59)
by Raúl
04:00
created
controllers/front/notify.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     private function getPagantisOrderId()
208 208
     {
209 209
         try {
210
-            $this->pagantisOrderId= Db::getInstance()->getValue(
210
+            $this->pagantisOrderId = Db::getInstance()->getValue(
211 211
                 'select order_id from '._DB_PREFIX_.'pagantis_order where id = '.$this->merchantOrderId
212 212
             );
213 213
 
@@ -269,20 +269,20 @@  discard block
 block discarded – undo
269 269
         $merchantAmount = explode('.', explode(',', $merchantAmount)[0])[0];
270 270
         if ($totalAmount != $merchantAmount) {
271 271
             try {
272
-                $psTotalAmount = substr_replace($merchantAmount, '.', (Tools::strlen($merchantAmount) -2), 0);
272
+                $psTotalAmount = substr_replace($merchantAmount, '.', (Tools::strlen($merchantAmount) - 2), 0);
273 273
 
274 274
                 $pgTotalAmountInCents = (string) $this->pagantisOrder->getShoppingCart()->getTotalAmount();
275 275
                 $pgTotalAmount = substr_replace(
276 276
                     $pgTotalAmountInCents,
277 277
                     '.',
278
-                    (Tools::strlen($pgTotalAmountInCents) -2),
278
+                    (Tools::strlen($pgTotalAmountInCents) - 2),
279 279
                     0
280 280
                 );
281 281
 
282
-                $this->amountMismatchError = '. Amount mismatch in PrestaShop Order #'. $this->merchantOrderId .
283
-                    ' compared with Pagantis Order: ' . $this->pagantisOrderId .
284
-                    '. The order in PrestaShop has an amount of ' . $psTotalAmount . ' and in Pagantis ' .
285
-                    $pgTotalAmount . ' PLEASE REVIEW THE ORDER';
282
+                $this->amountMismatchError = '. Amount mismatch in PrestaShop Order #'.$this->merchantOrderId.
283
+                    ' compared with Pagantis Order: '.$this->pagantisOrderId.
284
+                    '. The order in PrestaShop has an amount of '.$psTotalAmount.' and in Pagantis '.
285
+                    $pgTotalAmount.' PLEASE REVIEW THE ORDER';
286 286
                 $this->saveLog(array(
287 287
                     'message' => $this->amountMismatchError
288 288
                 ));
@@ -302,20 +302,20 @@  discard block
 block discarded – undo
302 302
         try {
303 303
             if ($this->merchantOrder->orderExists() !== false) {
304 304
                 throw new WrongStatusException('PS->orderExists() cart_id = '
305
-                    . $this->merchantOrderId . ' pagantis_id = '
306
-                    . $this->pagantisOrderId . '): already_processed');
305
+                    . $this->merchantOrderId.' pagantis_id = '
306
+                    . $this->pagantisOrderId.'): already_processed');
307 307
             }
308 308
 
309 309
             // Double check
310
-            $tableName = _DB_PREFIX_ . 'pagantis_order';
311
-            $sql = ('select ps_order_id from `' . $tableName . '` where `id` = ' . $this->merchantOrderId
312
-                . ' and `order_id` = \'' . $this->pagantisOrderId . '\''
310
+            $tableName = _DB_PREFIX_.'pagantis_order';
311
+            $sql = ('select ps_order_id from `'.$tableName.'` where `id` = '.$this->merchantOrderId
312
+                . ' and `order_id` = \''.$this->pagantisOrderId.'\''
313 313
                 . ' and `ps_order_id` is not null');
314 314
             $results = Db::getInstance()->ExecuteS($sql);
315 315
             if (is_array($results) && count($results) === 1) {
316
-                throw new WrongStatusException('PS->record found in ' . $tableName
317
-                    . ' (cart_id = ' . $this->merchantOrderId . ' pagantis_id = '
318
-                    . $this->pagantisOrderId . '): already_processed');
316
+                throw new WrongStatusException('PS->record found in '.$tableName
317
+                    . ' (cart_id = '.$this->merchantOrderId.' pagantis_id = '
318
+                    . $this->pagantisOrderId.'): already_processed');
319 319
             }
320 320
         } catch (\Exception $exception) {
321 321
             throw new UnknownException($exception->getMessage());
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
                 Configuration::get('PS_OS_PAYMENT'),
345 345
                 $this->merchantOrder->getOrderTotal(true),
346 346
                 $this->module->displayName,
347
-                'pagantisOrderId: ' . $this->pagantisOrder->getId() . ' ' .
348
-                'pagantisOrderStatus: '. $this->pagantisOrder->getStatus() .
349
-                $this->amountMismatchError .
347
+                'pagantisOrderId: '.$this->pagantisOrder->getId().' '.
348
+                'pagantisOrderStatus: '.$this->pagantisOrder->getStatus().
349
+                $this->amountMismatchError.
350 350
                 $metadataInfo,
351 351
                 array('transaction_id' => $this->pagantisOrderId),
352 352
                 null,
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
             Db::getInstance()->update(
361 361
                 'pagantis_order',
362 362
                 array('ps_order_id' => $this->module->currentOrder),
363
-                'id = \''. $this->merchantOrderId . '\' and order_id = \'' . $this->pagantisOrderId . '\''
363
+                'id = \''.$this->merchantOrderId.'\' and order_id = \''.$this->pagantisOrderId.'\''
364 364
             );
365 365
         } catch (\Exception $exception) {
366 366
             // Do nothing
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
             $this->orderClient->confirmOrder($this->pagantisOrderId);
379 379
             try {
380 380
                 $mode = ($_SERVER['REQUEST_METHOD'] == 'POST') ? 'NOTIFICATION' : 'REDIRECTION';
381
-                $message = 'Order CONFIRMED. The order was confirmed by a ' . $mode .
382
-                    '. Pagantis OrderId=' . $this->pagantisOrderId .
383
-                    '. Prestashop OrderId=' . $this->module->currentOrder;
381
+                $message = 'Order CONFIRMED. The order was confirmed by a '.$mode.
382
+                    '. Pagantis OrderId='.$this->pagantisOrderId.
383
+                    '. Prestashop OrderId='.$this->module->currentOrder;
384 384
                 $this->saveLog(array(
385 385
                     'message' => $message
386 386
                 ));
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
             );
428 428
             $resultSeconds = Db::getInstance()->getValue($query);
429 429
             $restSeconds = isset($resultSeconds) ? ($resultSeconds) : 0;
430
-            $secondsToExpire = ($restSeconds>self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds;
430
+            $secondsToExpire = ($restSeconds > self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds;
431 431
 
432 432
             $logMessage = sprintf(
433 433
                 "Redirect concurrency, User have to wait %s seconds, default seconds %s, bd time to expire %s seconds",
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             $this->saveLog(array(
440 440
                 'message' => $logMessage
441 441
             ));
442
-            sleep($secondsToExpire+1);
442
+            sleep($secondsToExpire + 1);
443 443
             // After waiting...user continue the confirmation, hoping that previous call have finished.
444 444
             return true;
445 445
         }
@@ -456,12 +456,12 @@  discard block
 block discarded – undo
456 456
             if (is_null($orderId)) {
457 457
                 Db::getInstance()->delete(
458 458
                     'pagantis_cart_process',
459
-                    'timestamp < ' . (time() - self::CONCURRENCY_TIMEOUT
459
+                    'timestamp < '.(time() - self::CONCURRENCY_TIMEOUT
460 460
                     )
461 461
                 );
462 462
                 return;
463 463
             }
464
-            Db::getInstance()->delete('pagantis_cart_process', 'id = \'' . $orderId . '\'');
464
+            Db::getInstance()->delete('pagantis_cart_process', 'id = \''.$orderId.'\'');
465 465
         } catch (\Exception $exception) {
466 466
             throw new ConcurrencyException();
467 467
         }
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
         $data = array(
484 484
             'merchantOrderId' => $this->merchantOrderId,
485 485
             'pagantisOrderId' => $this->pagantisOrderId,
486
-            'message' => ($exception)? $exception->getMessage() : 'Unable to get Exception message',
487
-            'statusCode' => ($exception)? $exception->getCode() : 'Unable to get Exception statusCode',
486
+            'message' => ($exception) ? $exception->getMessage() : 'Unable to get Exception message',
487
+            'statusCode' => ($exception) ? $exception->getCode() : 'Unable to get Exception statusCode',
488 488
             'method' => $method,
489 489
             'file' => __FILE__,
490 490
             'line' => $line,
@@ -508,9 +508,9 @@  discard block
 block discarded – undo
508 508
             'id_cart' => $this->merchantOrderId,
509 509
             'key' => $this->config['secureKey'],
510 510
             'id_module' => $this->module->id,
511
-            'id_order' => ($this->pagantisOrder)?$this->pagantisOrder->getId(): null,
511
+            'id_order' => ($this->pagantisOrder) ? $this->pagantisOrder->getId() : null,
512 512
         );
513
-        $url = ($error)? $this->config['urlKO'] : $this->config['urlOK'];
513
+        $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK'];
514 514
         return $this->redirect($url, $parameters);
515 515
     }
516 516
 }
517 517
\ No newline at end of file
Please login to merge, or discard this patch.
pagantis/vendor/nategood/httpful/bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require(__DIR__ . '/src/Httpful/Bootstrap.php');
3
+require(__DIR__.'/src/Httpful/Bootstrap.php');
4 4
 \Httpful\Bootstrap::init();
Please login to merge, or discard this patch.
pagantis/vendor/nategood/httpful/tests/Httpful/HttpfulTest.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -64,30 +64,30 @@  discard block
 block discarded – undo
64 64
 
65 65
     function testInit()
66 66
     {
67
-      $r = Request::init();
68
-      // Did we get a 'Request' object?
69
-      $this->assertEquals('Httpful\Request', get_class($r));
67
+        $r = Request::init();
68
+        // Did we get a 'Request' object?
69
+        $this->assertEquals('Httpful\Request', get_class($r));
70 70
     }
71 71
 
72 72
     function testDetermineLength()
73 73
     {
74
-      $r = Request::init();
75
-      $this->assertEquals(1, $r->_determineLength('A'));
76
-      $this->assertEquals(2, $r->_determineLength('À'));
77
-      $this->assertEquals(2, $r->_determineLength('Ab'));
78
-      $this->assertEquals(3, $r->_determineLength('Àb'));
79
-      $this->assertEquals(6, $r->_determineLength('世界'));
74
+        $r = Request::init();
75
+        $this->assertEquals(1, $r->_determineLength('A'));
76
+        $this->assertEquals(2, $r->_determineLength('À'));
77
+        $this->assertEquals(2, $r->_determineLength('Ab'));
78
+        $this->assertEquals(3, $r->_determineLength('Àb'));
79
+        $this->assertEquals(6, $r->_determineLength('世界'));
80 80
     }
81 81
 
82 82
     function testMethods()
83 83
     {
84
-      $valid_methods = array('get', 'post', 'delete', 'put', 'options', 'head');
85
-      $url = 'http://example.com/';
86
-      foreach ($valid_methods as $method) {
84
+        $valid_methods = array('get', 'post', 'delete', 'put', 'options', 'head');
85
+        $url = 'http://example.com/';
86
+        foreach ($valid_methods as $method) {
87 87
         $r = call_user_func(array('Httpful\Request', $method), $url);
88 88
         $this->assertEquals('Httpful\Request', get_class($r));
89 89
         $this->assertEquals(strtoupper($method), $r->method);
90
-      }
90
+        }
91 91
     }
92 92
 
93 93
     function testDefaults()
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
     function testSettingStrictSsl()
125 125
     {
126 126
         $r = Request::init()
127
-             ->withStrictSsl();
127
+                ->withStrictSsl();
128 128
 
129 129
         $this->assertTrue($r->strict_ssl);
130 130
 
131 131
         $r = Request::init()
132
-             ->withoutStrictSsl();
132
+                ->withoutStrictSsl();
133 133
 
134 134
         $this->assertFalse($r->strict_ssl);
135 135
     }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 namespace Httpful\Test;
11 11
 
12
-require(dirname(dirname(dirname(__FILE__))) . '/bootstrap.php');
12
+require(dirname(dirname(dirname(__FILE__))).'/bootstrap.php');
13 13
 \Httpful\Bootstrap::init();
14 14
 
15 15
 use Httpful\Httpful;
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 use Httpful\Response;
20 20
 use Httpful\Handlers\JsonHandler;
21 21
 
22
-define('TEST_SERVER', WEB_SERVER_HOST . ':' . WEB_SERVER_PORT);
22
+define('TEST_SERVER', WEB_SERVER_HOST.':'.WEB_SERVER_PORT);
23 23
 
24 24
 class HttpfulTest extends \PHPUnit_Framework_TestCase
25 25
 {
@@ -101,21 +101,21 @@  discard block
 block discarded – undo
101 101
     function testShortMime()
102 102
     {
103 103
         // Valid short ones
104
-        $this->assertEquals(Mime::JSON,  Mime::getFullMime('json'));
105
-        $this->assertEquals(Mime::XML,   Mime::getFullMime('xml'));
106
-        $this->assertEquals(Mime::HTML,  Mime::getFullMime('html'));
107
-        $this->assertEquals(Mime::CSV,  Mime::getFullMime('csv'));
108
-        $this->assertEquals(Mime::UPLOAD,  Mime::getFullMime('upload'));
104
+        $this->assertEquals(Mime::JSON, Mime::getFullMime('json'));
105
+        $this->assertEquals(Mime::XML, Mime::getFullMime('xml'));
106
+        $this->assertEquals(Mime::HTML, Mime::getFullMime('html'));
107
+        $this->assertEquals(Mime::CSV, Mime::getFullMime('csv'));
108
+        $this->assertEquals(Mime::UPLOAD, Mime::getFullMime('upload'));
109 109
 
110 110
         // Valid long ones
111 111
         $this->assertEquals(Mime::JSON, Mime::getFullMime(Mime::JSON));
112
-        $this->assertEquals(Mime::XML,  Mime::getFullMime(Mime::XML));
112
+        $this->assertEquals(Mime::XML, Mime::getFullMime(Mime::XML));
113 113
         $this->assertEquals(Mime::HTML, Mime::getFullMime(Mime::HTML));
114 114
         $this->assertEquals(Mime::CSV, Mime::getFullMime(Mime::CSV));
115 115
         $this->assertEquals(Mime::UPLOAD, Mime::getFullMime(Mime::UPLOAD));
116 116
 
117 117
         // No false positives
118
-        $this->assertNotEquals(Mime::XML,  Mime::getFullMime(Mime::HTML));
118
+        $this->assertNotEquals(Mime::XML, Mime::getFullMime(Mime::HTML));
119 119
         $this->assertNotEquals(Mime::JSON, Mime::getFullMime(Mime::XML));
120 120
         $this->assertNotEquals(Mime::HTML, Mime::getFullMime(Mime::JSON));
121 121
         $this->assertNotEquals(Mime::XML, Mime::getFullMime(Mime::CSV));
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
         $this->assertEquals("object", gettype($sxe));
277 277
         $this->assertEquals("SimpleXMLElement", get_class($sxe));
278 278
         $bools = $sxe->xpath('/stdClass/boolProp');
279
-        list( , $bool ) = each($bools);
279
+        list(, $bool) = each($bools);
280 280
         $this->assertEquals("TRUE", (string) $bool);
281 281
         $ints = $sxe->xpath('/stdClass/arrayProp/array/k1/myClass/intProp');
282
-        list( , $int ) = each($ints);
282
+        list(, $int) = each($ints);
283 283
         $this->assertEquals("2", (string) $int);
284 284
         $strings = $sxe->xpath('/stdClass/stringProp');
285
-        list( , $string ) = each($strings);
285
+        list(, $string) = each($strings);
286 286
         $this->assertEquals("a string", (string) $string);
287 287
     }
288 288
 
@@ -322,14 +322,14 @@  discard block
 block discarded – undo
322 322
 
323 323
     function testAttach() {
324 324
         $req = Request::init();
325
-        $testsPath = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..');
326
-        $filename = $testsPath . DIRECTORY_SEPARATOR . 'test_image.jpg';
325
+        $testsPath = realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'..');
326
+        $filename = $testsPath.DIRECTORY_SEPARATOR.'test_image.jpg';
327 327
         $req->attach(array('index' => $filename));
328 328
         $payload = $req->payload['index'];
329 329
         // PHP 5.5  + will take advantage of CURLFile while previous
330 330
         // versions just use the string syntax
331 331
         if (is_string($payload)) {
332
-            $this->assertEquals($payload, '@' . $filename . ';type=image/jpeg');
332
+            $this->assertEquals($payload, '@'.$filename.';type=image/jpeg');
333 333
         } else {
334 334
             $this->assertInstanceOf('CURLFile', $payload);
335 335
         }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
         try {
420 420
             Request::get('malformed://url')
421
-                ->beforeSend(function($request) use(&$invoked,$self) {
421
+                ->beforeSend(function($request) use(&$invoked, $self) {
422 422
                     $self->assertEquals('malformed://url', $request->uri);
423 423
                     $self->assertEquals('A payload', $request->serialized_payload);
424 424
                     $request->uri('malformed2://url');
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
     {
449 449
         $req = Request::init()->sendsAndExpects(Mime::JSON);
450 450
         $response = new Response(self::SAMPLE_JSON_RESPONSE, self::SAMPLE_JSON_HEADER, $req);
451
-        $this->assertEquals(self::SAMPLE_JSON_RESPONSE, (string)$response);
451
+        $this->assertEquals(self::SAMPLE_JSON_RESPONSE, (string) $response);
452 452
     }
453 453
 
454 454
     function test_parseHeaders()
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 
571 571
         try {
572 572
             $result = $handler->parse('invalid{json');
573
-        } catch(\Exception $e) {
573
+        } catch (\Exception $e) {
574 574
             $this->assertEquals('Unable to parse response as JSON', $e->getMessage());
575 575
             return;
576 576
         }
Please login to merge, or discard this patch.
pagantis/vendor/nategood/httpful/tests/bootstrap-server.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@
 block discarded – undo
26 26
     $server_logs = file_get_contents("./server.log");
27 27
     if (strpos($server_logs, "Fail") !== false) {
28 28
         // server failed to start for some reason
29
-        print "Failed to start server! Logs:" . PHP_EOL . PHP_EOL;
29
+        print "Failed to start server! Logs:".PHP_EOL.PHP_EOL;
30 30
         print_r($server_logs);
31 31
         exit(1);
32 32
     }
33 33
 
34
-    echo sprintf('%s - Web server started on %s:%d with PID %d', date('r'), WEB_SERVER_HOST, WEB_SERVER_PORT, $pid) . PHP_EOL;
34
+    echo sprintf('%s - Web server started on %s:%d with PID %d', date('r'), WEB_SERVER_HOST, WEB_SERVER_PORT, $pid).PHP_EOL;
35 35
 
36 36
     register_shutdown_function(function() {
37 37
         // cleanup after ourselves -- remove log file, shut down server
Please login to merge, or discard this patch.
vendor/nategood/httpful/src/Httpful/Handlers/MimeHandlerAdapter.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@
 block discarded – undo
43 43
 
44 44
     protected function stripBom($body)
45 45
     {
46
-        if ( substr($body,0,3) === "\xef\xbb\xbf" )  // UTF-8
47
-            $body = substr($body,3);
48
-        else if ( substr($body,0,4) === "\xff\xfe\x00\x00" || substr($body,0,4) === "\x00\x00\xfe\xff" )  // UTF-32
49
-            $body = substr($body,4);
50
-        else if ( substr($body,0,2) === "\xff\xfe" || substr($body,0,2) === "\xfe\xff" )  // UTF-16
51
-            $body = substr($body,2);
46
+        if (substr($body, 0, 3) === "\xef\xbb\xbf")  // UTF-8
47
+            $body = substr($body, 3);
48
+        else if (substr($body, 0, 4) === "\xff\xfe\x00\x00" || substr($body, 0, 4) === "\x00\x00\xfe\xff")  // UTF-32
49
+            $body = substr($body, 4);
50
+        else if (substr($body, 0, 2) === "\xff\xfe" || substr($body, 0, 2) === "\xfe\xff")  // UTF-16
51
+            $body = substr($body, 2);
52 52
         return $body;
53 53
     }
54 54
 }
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,12 +43,16 @@
 block discarded – undo
43 43
 
44 44
     protected function stripBom($body)
45 45
     {
46
-        if ( substr($body,0,3) === "\xef\xbb\xbf" )  // UTF-8
46
+        if ( substr($body,0,3) === "\xef\xbb\xbf" ) {
47
+            // UTF-8
47 48
             $body = substr($body,3);
48
-        else if ( substr($body,0,4) === "\xff\xfe\x00\x00" || substr($body,0,4) === "\x00\x00\xfe\xff" )  // UTF-32
49
+        } else if ( substr($body,0,4) === "\xff\xfe\x00\x00" || substr($body,0,4) === "\x00\x00\xfe\xff" ) {
50
+            // UTF-32
49 51
             $body = substr($body,4);
50
-        else if ( substr($body,0,2) === "\xff\xfe" || substr($body,0,2) === "\xfe\xff" )  // UTF-16
52
+        } else if ( substr($body,0,2) === "\xff\xfe" || substr($body,0,2) === "\xfe\xff" ) {
53
+            // UTF-16
51 54
             $body = substr($body,2);
55
+        }
52 56
         return $body;
53 57
     }
54 58
 }
55 59
\ No newline at end of file
Please login to merge, or discard this patch.
pagantis/vendor/nategood/httpful/src/Httpful/Handlers/CsvHandler.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
             return null;
20 20
 
21 21
         $parsed = array();
22
-        $fp = fopen('data://text/plain;base64,' . base64_encode($body), 'r');
22
+        $fp = fopen('data://text/plain;base64,'.base64_encode($body), 'r');
23 23
         while (($r = fgetcsv($fp)) !== FALSE) {
24 24
             $parsed[] = $r;
25 25
         }
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function serialize($payload)
37 37
     {
38
-        $fp = fopen('php://temp/maxmemory:'. (6*1024*1024), 'r+');
38
+        $fp = fopen('php://temp/maxmemory:'.(6 * 1024 * 1024), 'r+');
39 39
         $i = 0;
40 40
         foreach ($payload as $fields) {
41
-            if($i++ == 0) {
41
+            if ($i++ == 0) {
42 42
                 fputcsv($fp, array_keys($fields));
43 43
             }
44 44
             fputcsv($fp, $fields);
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function parse($body)
17 17
     {
18
-        if (empty($body))
19
-            return null;
18
+        if (empty($body)) {
19
+                    return null;
20
+        }
20 21
 
21 22
         $parsed = array();
22 23
         $fp = fopen('data://text/plain;base64,' . base64_encode($body), 'r');
@@ -24,8 +25,9 @@  discard block
 block discarded – undo
24 25
             $parsed[] = $r;
25 26
         }
26 27
 
27
-        if (empty($parsed))
28
-            throw new \Exception("Unable to parse response as CSV");
28
+        if (empty($parsed)) {
29
+                    throw new \Exception("Unable to parse response as CSV");
30
+        }
29 31
         return $parsed;
30 32
     }
31 33
 
Please login to merge, or discard this patch.
pagantis/vendor/nategood/httpful/src/Httpful/Handlers/JsonHandler.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,11 +23,13 @@
 block discarded – undo
23 23
     public function parse($body)
24 24
     {
25 25
         $body = $this->stripBom($body);
26
-        if (empty($body))
27
-            return null;
26
+        if (empty($body)) {
27
+                    return null;
28
+        }
28 29
         $parsed = json_decode($body, $this->decode_as_array);
29
-        if (is_null($parsed) && 'null' !== strtolower($body))
30
-            throw new \Exception("Unable to parse response as JSON");
30
+        if (is_null($parsed) && 'null' !== strtolower($body)) {
31
+                    throw new \Exception("Unable to parse response as JSON");
32
+        }
31 33
         return $parsed;
32 34
     }
33 35
 
Please login to merge, or discard this patch.
pagantis/vendor/nategood/httpful/src/Httpful/Handlers/XmlHandler.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function __construct(array $conf = array())
27 27
     {
28
-        $this->namespace =      isset($conf['namespace']) ? $conf['namespace'] : '';
29
-        $this->libxml_opts =    isset($conf['libxml_opts']) ? $conf['libxml_opts'] : 0;
28
+        $this->namespace = isset($conf['namespace']) ? $conf['namespace'] : '';
29
+        $this->libxml_opts = isset($conf['libxml_opts']) ? $conf['libxml_opts'] : 0;
30 30
     }
31 31
 
32 32
     /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $xml = new \XMLWriter;
67 67
         $xml->openMemory();
68
-        $xml->startDocument('1.0','ISO-8859-1');
68
+        $xml->startDocument('1.0', 'ISO-8859-1');
69 69
         $this->serialize_node($xml, $payload);
70 70
         return $xml->outputMemory(true);
71 71
     }
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
      * @param mixed $node to serialize
76 76
      * @author Ted Zellers
77 77
      */
78
-    public function serialize_node(&$xmlw, $node){
79
-        if (!is_array($node)){
78
+    public function serialize_node(&$xmlw, $node) {
79
+        if (!is_array($node)) {
80 80
             $xmlw->text($node);
81 81
         } else {
82
-            foreach ($node as $k => $v){
82
+            foreach ($node as $k => $v) {
83 83
                 $xmlw->startElement($k);
84 84
                     $this->serialize_node($xmlw, $v);
85 85
                 $xmlw->endElement();
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             $node->appendChild($arrNode);
113 113
             $this->_future_serializeArrayAsXml($value, $arrNode, $dom);
114 114
         } else if (is_bool($value)) {
115
-            $node->appendChild($dom->createTextNode($value?'TRUE':'FALSE'));
115
+            $node->appendChild($dom->createTextNode($value ? 'TRUE' : 'FALSE'));
116 116
         } else {
117 117
             $node->appendChild($dom->createTextNode($value));
118 118
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,11 +37,13 @@
 block discarded – undo
37 37
     public function parse($body)
38 38
     {
39 39
         $body = $this->stripBom($body);
40
-        if (empty($body))
41
-            return null;
40
+        if (empty($body)) {
41
+                    return null;
42
+        }
42 43
         $parsed = simplexml_load_string($body, null, $this->libxml_opts, $this->namespace);
43
-        if ($parsed === false)
44
-            throw new \Exception("Unable to parse response as XML");
44
+        if ($parsed === false) {
45
+                    throw new \Exception("Unable to parse response as XML");
46
+        }
45 47
         return $parsed;
46 48
     }
47 49
 
Please login to merge, or discard this patch.
pagantis/vendor/nategood/httpful/src/Httpful/Response.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@  discard block
 block discarded – undo
11 11
 {
12 12
 
13 13
     public $body,
14
-           $raw_body,
15
-           $headers,
16
-           $raw_headers,
17
-           $request,
18
-           $code = 0,
19
-           $content_type,
20
-           $parent_type,
21
-           $charset,
22
-           $meta_data,
23
-           $is_mime_vendor_specific = false,
24
-           $is_mime_personal = false;
14
+            $raw_body,
15
+            $headers,
16
+            $raw_headers,
17
+            $request,
18
+            $code = 0,
19
+            $content_type,
20
+            $parent_type,
21
+            $charset,
22
+            $meta_data,
23
+            $is_mime_vendor_specific = false,
24
+            $is_mime_personal = false;
25 25
 
26 26
     private $parsers;
27 27
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 : $this->parent_type;
105 105
         }
106 106
 
107
-       return Httpful::get($parse_with)->parse($body);
107
+        return Httpful::get($parse_with)->parse($body);
108 108
     }
109 109
 
110 110
     /**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
         $this->_interpretHeaders();
45 45
 
46
-        $this->body         = $this->_parse($body);
46
+        $this->body = $this->_parse($body);
47 47
     }
48 48
 
49 49
     /**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 // If a header appears more than once, it must also be able to
128 128
                 // be represented as a single header with a comma-separated
129 129
                 // list of values.  We transform accordingly.
130
-                $parse_headers[$key] .= ',' . $value;
130
+                $parse_headers[$key] .= ','.$value;
131 131
             } else {
132 132
                 $parse_headers[$key] = $value;
133 133
             }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,9 @@
 block discarded – undo
138 138
     public function _parseCode($headers)
139 139
     {
140 140
         $end = strpos($headers, "\r\n");
141
-        if ($end === false) $end = strlen($headers);
141
+        if ($end === false) {
142
+            $end = strlen($headers);
143
+        }
142 144
         $parts = explode(' ', substr($headers, 0, $end));
143 145
         if (count($parts) < 2 || !is_numeric($parts[1])) {
144 146
             throw new \Exception("Unable to parse response code from HTTP response due to malformed response");
Please login to merge, or discard this patch.