Completed
Push — master ( eccdf7...f1de52 )
by Mario
02:37
created
Models/lightConnector.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      */
38 38
     protected $transactionId = null;
39 39
     
40
-    protected $apiUrl = array('live'=>'https://api.klarna.com/','test'=>'https://api.playground.klarna.com/');
40
+    protected $apiUrl = array('live'=>'https://api.klarna.com/', 'test'=>'https://api.playground.klarna.com/');
41 41
 
42 42
     /**
43 43
      * Creates an instance of light connector
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,7 +5,8 @@  discard block
 block discarded – undo
5 5
  *
6 6
  * @author andre
7 7
  */
8
-class lightConnector {
8
+class lightConnector
9
+{
9 10
 
10 11
     /**
11 12
      * Connecting method
@@ -45,7 +46,8 @@  discard block
 block discarded – undo
45 46
      * @param type $config
46 47
      * @param type $method
47 48
      */
48
-    public function __construct($config, $method = null) {
49
+    public function __construct($config, $method = null)
50
+    {
49 51
         parent::__construct();
50 52
         $this->method = $method;
51 53
         $this->config = $config;
@@ -57,7 +59,8 @@  discard block
 block discarded – undo
57 59
      * @param string $method
58 60
      * @return void
59 61
      */
60
-    public function setMethod($method) {
62
+    public function setMethod($method)
63
+    {
61 64
         $this->method = $method;
62 65
     }
63 66
 
@@ -67,7 +70,8 @@  discard block
 block discarded – undo
67 70
      * @param string $klarnaOrderId
68 71
      * @return void
69 72
      */
70
-    public function setKlarnaOrderId($klarnaOrderId) {
73
+    public function setKlarnaOrderId($klarnaOrderId)
74
+    {
71 75
         $this->klarnaOrderId = $klarnaOrderId;
72 76
     }
73 77
 
@@ -76,7 +80,8 @@  discard block
 block discarded – undo
76 80
      * 
77 81
      * @param string $transactionId
78 82
      */
79
-    public function setTransactionId($transactionId) {
83
+    public function setTransactionId($transactionId)
84
+    {
80 85
         $this->transactionId = $transactionId;
81 86
     }
82 87
 
@@ -87,7 +92,8 @@  discard block
 block discarded – undo
87 92
      * @param array $shippingAddress
88 93
      * @return void
89 94
      */
90
-    public function updateCustomerAddress($billingAddress, $shippingAddress = false) {
95
+    public function updateCustomerAddress($billingAddress, $shippingAddress = false)
96
+    {
91 97
         $aAddressParts = array('');
92 98
     }
93 99
     
@@ -96,7 +102,8 @@  discard block
 block discarded – undo
96 102
      * 
97 103
      * @param array $data
98 104
      */
99
-    protected function setCall($data) {
105
+    protected function setCall($data)
106
+    {
100 107
         $testdrive = $this->config->get('testDrive');
101 108
         $url = ($testdrive) ? $this->apiUrl['test'] : $this->apiUrl['live'];
102 109
         
Please login to merge, or discard this patch.
Bootstrap.php 5 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,6 @@
 block discarded – undo
22 22
  * our trademarks remain entirely with us.
23 23
  */
24 24
 
25
-use Doctrine\DBAL\Connection;
26 25
 use Shopware\Components\StreetSplitService;
27 26
 
28 27
 # Load dummy interface CSRFWhitelistAware for SW < 5.2
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
         $args->setReturn($builder);
492 492
     }
493 493
 
494
-     public function onGetStreetSplitService()
494
+        public function onGetStreetSplitService()
495 495
     {
496 496
         $this->Application()->Loader()->registerNamespace(
497 497
             'Shopware\Components',
@@ -1364,12 +1364,12 @@  discard block
 block discarded – undo
1364 1364
         /** @var Enlight_Components_Session_Namespace $session */
1365 1365
         $session = $this->Application()->Session();
1366 1366
 
1367
-         // Switch User to external PaymentId after registration
1368
-         if (isset($session['KlarnaExternalPaymentId'])) {
1367
+            // Switch User to external PaymentId after registration
1368
+            if (isset($session['KlarnaExternalPaymentId'])) {
1369 1369
                 $this->savePayment($session['KlarnaExternalPaymentId']);
1370 1370
         }
1371 1371
 
1372
-       $view->assign('klarnaRedirect', $request->has('klarnaRedirect') && $request->getParam('klarnaRedirect') == 1);
1372
+        $view->assign('klarnaRedirect', $request->has('klarnaRedirect') && $request->getParam('klarnaRedirect') == 1);
1373 1373
     }
1374 1374
     
1375 1375
 
@@ -1460,7 +1460,7 @@  discard block
 block discarded – undo
1460 1460
             $userData['billingaddress']['country'] =$country;   
1461 1461
             $userData['shippingaddress']['countryID'] = $session['sChangedCountry'];
1462 1462
             $userData['billingaddress']['countryID'] = $session['sChangedCountry'];
1463
-         }
1463
+            }
1464 1464
         
1465 1465
         $orderVariables['sUserData'] = $userData;
1466 1466
         $testbreakpoint = 0;
@@ -2385,14 +2385,14 @@  discard block
 block discarded – undo
2385 2385
                 } else {
2386 2386
                     $url = $front->Router()->assemble(array('controller' => 'index', 'module' => 'frontend'));
2387 2387
                 }
2388
-		if (version_compare(Shopware::VERSION, '5.2.0', '>=')) {
2388
+        if (version_compare(Shopware::VERSION, '5.2.0', '>=')) {
2389 2389
             # make sure me get only the image name, path is set in case of upgarde from SW.5.1 to 5.2
2390 2390
             $parts = explode('/', $media);
2391 2391
             $end = end($parts);
2392
-			$media = $url . 'media/image/' . $end;
2393
-		} else {
2394
-	                $media = $url . $media;
2395
-		}
2392
+            $media = $url . 'media/image/' . $end;
2393
+        } else {
2394
+                    $media = $url . $media;
2395
+        }
2396 2396
             }
2397 2397
 
2398 2398
             return $media;
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
             
401 401
             $klarnaService = $this->getService();
402 402
 
403
-            $klarnaAddrBilling = $this->getKlarnaAddrByRawOrderData($orderDataRaw,'billing');
404
-            $klarnaAddrShipping = $this->getKlarnaAddrByRawOrderData($orderDataRaw,'shipping');
403
+            $klarnaAddrBilling = $this->getKlarnaAddrByRawOrderData($orderDataRaw, 'billing');
404
+            $klarnaAddrShipping = $this->getKlarnaAddrByRawOrderData($orderDataRaw, 'shipping');
405 405
 
406 406
             $transactionId = $orderDataRaw['transactionId'];
407 407
             
@@ -509,27 +509,27 @@  discard block
 block discarded – undo
509 509
      * @param mixed $mPrintableElement
510 510
      * @return void
511 511
      */
512
-    public function klarnaLog($message, $logLevelMessage=1, $mPrintableElement=null) {
512
+    public function klarnaLog($message, $logLevelMessage = 1, $mPrintableElement = null) {
513 513
         $configname = 'klarnaLogLevel';
514 514
         $elementId = Shopware()->Db()->fetchOne('SELECT id FROM s_core_config_elements WHERE name = ?', [$configname]);
515 515
         $logLevelConfigSetting = Shopware()->Db()->fetchOne('SELECT value FROM s_core_config_values WHERE element_id = ?', [$elementId]);
516 516
         $logLevelConfigSetting = unserialize($logLevelConfigSetting);
517
-        $logLevelSetting = (is_numeric($logLevelConfigSetting) && $logLevelConfigSetting >=0 && $logLevelConfigSetting <=4) ? (int)$logLevelConfigSetting : 1;
517
+        $logLevelSetting = (is_numeric($logLevelConfigSetting) && $logLevelConfigSetting >= 0 && $logLevelConfigSetting <= 4) ? (int) $logLevelConfigSetting : 1;
518 518
         
519 519
         if ($logLevelMessage <= $logLevelSetting) {
520
-            $prefix = "[".date('Y-m-d H:i:s')."] ";
520
+            $prefix = "[" . date('Y-m-d H:i:s') . "] ";
521 521
             $debugBacktrace = '';
522 522
             if ($logLevelSetting >= 4) {
523
-                $debugBacktrace = print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS),true);
523
+                $debugBacktrace = print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true);
524 524
             }
525 525
             $sPrintableElementMessage = '';
526 526
             if ($mPrintableElement !== null) {
527
-                $sPrintableElementMessage = print_r($mPrintableElement,true);
527
+                $sPrintableElementMessage = print_r($mPrintableElement, true);
528 528
             }
529
-            $fullMessage = $prefix.$message."\n".$sPrintableElementMessage.$debugBacktrace;
529
+            $fullMessage = $prefix . $message . "\n" . $sPrintableElementMessage . $debugBacktrace;
530 530
             $shopPath = Shopware()->DocPath();
531
-            $logfilePath = $shopPath.'/var/log/klarnaTrace.log';
532
-            $fileHandler = fopen($logfilePath,'a');
531
+            $logfilePath = $shopPath . '/var/log/klarnaTrace.log';
532
+            $fileHandler = fopen($logfilePath, 'a');
533 533
             fwrite($fileHandler, $fullMessage);
534 534
             fclose($fileHandler);
535 535
         }
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
             $country = $repository->findOneBy(array('id' => $baseData['countryId']));
556 556
             $countryiso = $country->getIso();
557 557
 
558
-            $klarnaAddr =  new KlarnaAddr();
558
+            $klarnaAddr = new KlarnaAddr();
559 559
             $klarnaAddr->setEmail($orderDataRaw['customerEmail']);
560 560
             $klarnaAddr->setFirstName($baseData['firstName']);
561 561
             $klarnaAddr->setLastName($baseData['lastName']);
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
             $klarnaAddr->setCountry($countryiso);
571 571
         }
572 572
 
573
-        $this->klarnaLog('Update order address from backend with following address data:',3,$klarnaAddr);
573
+        $this->klarnaLog('Update order address from backend with following address data:', 3, $klarnaAddr);
574 574
         return $klarnaAddr;
575 575
     }
576 576
 
@@ -598,10 +598,10 @@  discard block
 block discarded – undo
598 598
             if ($index == count($addressParts) || $houseNumberFound) {
599 599
                 // at least last element should be streetnr
600 600
                 if (!empty($streetnr)) $streetnr .= ' ';
601
-                $streetnr .= (string)$addressPart;
601
+                $streetnr .= (string) $addressPart;
602 602
             }
603
-            else  {
604
-                $street .= (string)' '.$addressPart;
603
+            else {
604
+                $street .= (string) ' ' . $addressPart;
605 605
             }
606 606
         }
607 607
 
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
             $streetnr_extension .= $baseData['additionalAddressLine1'];
611 611
         }
612 612
         if (!empty($baseData['additionalAddressLine2'])) {
613
-            $streetnr_extension .= "\n".$baseData['additionalAddressLine2'];
613
+            $streetnr_extension .= "\n" . $baseData['additionalAddressLine2'];
614 614
         }
615 615
 
616 616
         $return = array(
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
 
1290 1290
         // just return in case kco payment is deactivated in backend
1291 1291
 
1292
-        if (!$this->isKcoPaymentActive()){
1292
+        if (!$this->isKcoPaymentActive()) {
1293 1293
             return;
1294 1294
         }
1295 1295
         $user = $view->getAssign('sUserData');
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
             && ($request->getActionName() == 'cart' || $request->getActionName() == 'ajaxCart')
1301 1301
         ) {
1302 1302
             $this->registerMyTemplateDir();
1303
-            $view->assign('KlarnaEnableButton', (bool)$config->get('showKlarnaButton'));
1303
+            $view->assign('KlarnaEnableButton', (bool) $config->get('showKlarnaButton'));
1304 1304
             $view->assign('KlarnaShowCheckoutButton', $this->getShowCheckoutButton($user));
1305 1305
             $view->assign('klarnaKcoPaymentActive', $this->isKlarnaKcoPaymentActive($user));
1306 1306
             $view->assign('KlarnaPaymentDescription', $this->getPayment()->getDescription());
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
             $view->assign('KlarnaMerchantId', $config->get('merchantId'));
1330 1330
             $view->assign('KlarnaHideCheckoutSteps', true);
1331 1331
             
1332
-            if (version_compare(Shopware::VERSION, '5.2.0', '<')){
1332
+            if (version_compare(Shopware::VERSION, '5.2.0', '<')) {
1333 1333
                 $view->assign('KlarnaSkipLoginFix', true);
1334 1334
             }
1335 1335
             if (!$this->isTemplateResponsive()) {
@@ -1449,15 +1449,15 @@  discard block
 block discarded – undo
1449 1449
             $userData['additional']
1450 1450
         );
1451 1451
         
1452
-        if (isset($session['sChangedCountry'])){
1452
+        if (isset($session['sChangedCountry'])) {
1453 1453
             
1454 1454
             /** @var \Shopware\Components\Model\ModelManager $em */
1455 1455
             $em = $this->get('models');
1456 1456
 
1457 1457
             /** @var \Shopware\Models\Customer\Customer $customer */
1458 1458
             $country = $em->getRepository('Shopware\Models\Country\Country')->findOneBy(array('id' => $session['sChangedCountry']));            
1459
-            $userData['shippingaddress']['country'] =$country;     
1460
-            $userData['billingaddress']['country'] =$country;   
1459
+            $userData['shippingaddress']['country'] = $country;     
1460
+            $userData['billingaddress']['country'] = $country;   
1461 1461
             $userData['shippingaddress']['countryID'] = $session['sChangedCountry'];
1462 1462
             $userData['billingaddress']['countryID'] = $session['sChangedCountry'];
1463 1463
          }
@@ -1477,10 +1477,10 @@  discard block
 block discarded – undo
1477 1477
         $this->klarnaLog("Entering Bootstrap::getCountryByShop", 3);
1478 1478
         $locale = explode('_', $locale);
1479 1479
         $locale = isset($locale[1]) ? $locale[1] : $locale[0];
1480
-        $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale,3);
1480
+        $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:" . $locale, 3);
1481 1481
         $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?';
1482 1482
         $countryId = Shopware()->Db()->fetchOne($sql, array($locale));
1483
-        $countryId = ($countryId) ? (int)$countryId : null;
1483
+        $countryId = ($countryId) ? (int) $countryId : null;
1484 1484
                 
1485 1485
         return $countryId;
1486 1486
     }
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
         $locale = $locale == 'nn-no' ? 'nb-no' : $locale;
1512 1512
 
1513 1513
         if ($locale == 'de-de') {
1514
-            if($countryIso == 'CH') {
1514
+            if ($countryIso == 'CH') {
1515 1515
                 $locale = 'de-ch';
1516 1516
             } elseif ($countryIso == 'AT') {
1517 1517
                 $locale = 'de-at';
@@ -1526,10 +1526,10 @@  discard block
 block discarded – undo
1526 1526
         $config = $this->Config();
1527 1527
         $options = $this->getColorConfigOptions($config);
1528 1528
 
1529
-        $options['allow_separate_shipping_address'] = (bool)$config->get('allowSeparateShippingAddress');
1530
-        $options['packstation_enabled'] = (bool)$config->get('supportPackstation') && $allowPackstation;
1531
-        $options['phone_mandatory'] = (bool)$config->get('mandatoryPhone');
1532
-        $options['date_of_birth_mandatory'] = (bool)$config->get('mandatoryBirthday');
1529
+        $options['allow_separate_shipping_address'] = (bool) $config->get('allowSeparateShippingAddress');
1530
+        $options['packstation_enabled'] = (bool) $config->get('supportPackstation') && $allowPackstation;
1531
+        $options['phone_mandatory'] = (bool) $config->get('mandatoryPhone');
1532
+        $options['date_of_birth_mandatory'] = (bool) $config->get('mandatoryBirthday');
1533 1533
 
1534 1534
         if (!empty($dispatch)) {
1535 1535
             $options['shipping_details'] = $dispatch['description'];
@@ -1544,19 +1544,19 @@  discard block
 block discarded – undo
1544 1544
         foreach ($basket['content'] as $index=>$basketItem) {
1545 1545
             // compatibility to shopware plugin custom products
1546 1546
             if (isset($basketItem['custom_product_prices'])) {
1547
-                $basketItemPrice = (double)$basketItem['custom_product_prices']['total'];
1547
+                $basketItemPrice = (double) $basketItem['custom_product_prices']['total'];
1548 1548
             }
1549 1549
             else {
1550
-                $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']);
1550
+                $basketItemPrice = (double) str_replace(',', '.', $basketItem['price']);
1551 1551
             }
1552 1552
             $unitPrice = round($basketItemPrice * 100);
1553 1553
             $cart[] = array(
1554 1554
                 'type' => $unitPrice >= 0 ? 'physical' : 'discount',
1555 1555
                 'reference' => $basketItem['ordernumber'],
1556 1556
                 'name' => $basketItem['articlename'],
1557
-                'quantity' => (int)$basketItem['quantity'],
1558
-                'unit_price' => (int)$unitPrice,
1559
-                'tax_rate' => (int)round($basketItem['tax_rate'] * 100)
1557
+                'quantity' => (int) $basketItem['quantity'],
1558
+                'unit_price' => (int) $unitPrice,
1559
+                'tax_rate' => (int) round($basketItem['tax_rate'] * 100)
1560 1560
             );
1561 1561
         }
1562 1562
         if (!empty($basket['sShippingcosts'])) {
@@ -1567,8 +1567,8 @@  discard block
 block discarded – undo
1567 1567
                 'reference' => 'SHIPPING',
1568 1568
                 'name' => 'Shipping Fee',
1569 1569
                 'quantity' => 1,
1570
-                'unit_price' => (int)round($shippingAmount * 100),
1571
-                'tax_rate' => (int)round($basket['sShippingcostsTax'] * 100),
1570
+                'unit_price' => (int) round($shippingAmount * 100),
1571
+                'tax_rate' => (int) round($basket['sShippingcostsTax'] * 100),
1572 1572
             );
1573 1573
         }
1574 1574
 
@@ -1654,7 +1654,7 @@  discard block
 block discarded – undo
1654 1654
         }
1655 1655
 
1656 1656
         // Make sure phone number is unset if empty
1657
-        if ($address['phone'] === null){
1657
+        if ($address['phone'] === null) {
1658 1658
             unset($address['phone']);
1659 1659
         }
1660 1660
         return $address;
@@ -1824,7 +1824,7 @@  discard block
 block discarded – undo
1824 1824
 
1825 1825
         $salutation = $form['register']['personal']['salutation'];
1826 1826
         if (!empty($salutation) && ($countryIso == 'DE' || $countryIso == 'NL')) {
1827
-            $create['shipping_address']['title'] = ($salutation == 'ms' ? 'Frau' : 'Herr');//German names
1827
+            $create['shipping_address']['title'] = ($salutation == 'ms' ? 'Frau' : 'Herr'); //German names
1828 1828
         }
1829 1829
 
1830 1830
         $billingStreet = $form['register']['billing']['street'];
@@ -1900,9 +1900,9 @@  discard block
 block discarded – undo
1900 1900
         $view->assign('sPayments', $this->filterPayments($adminModule->sGetPaymentMeans()));
1901 1901
         $view->assign('sCountryList', $adminModule->sGetCountryList());
1902 1902
         $view->assign('KlarnaHideCheckoutSteps', true);
1903
-        $view->assign('KlarnaShowB2bSelect', (bool)$config->get('showB2bSelect'));
1904
-        $view->assign('KlarnaShowBasket', (bool)$config->get('showMiniBasket'));
1905
-        $view->assign('KlarnaShowDispatch', (bool)$config->get('showDispatch'));
1903
+        $view->assign('KlarnaShowB2bSelect', (bool) $config->get('showB2bSelect'));
1904
+        $view->assign('KlarnaShowBasket', (bool) $config->get('showMiniBasket'));
1905
+        $view->assign('KlarnaShowDispatch', (bool) $config->get('showDispatch'));
1906 1906
         $view->assign(
1907 1907
             'KlarnaCDNLink',
1908 1908
             $this->buildCDNLink()
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
             $view->sUserData['billingaddress']['lastname'] == 'Klarna Checkout'
1913 1913
         );
1914 1914
         $debugShowLogin = !empty($session->sUserId);
1915
-        $debugShowLogin2 = $this->getShowLoginConfig($config,!empty($session->sUserId));
1915
+        $debugShowLogin2 = $this->getShowLoginConfig($config, !empty($session->sUserId));
1916 1916
         $view->assign(
1917 1917
             'KlarnaShowLogin',
1918 1918
             $this->getShowLoginConfig($config, !empty($session->sUserId))
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
      */
1937 1937
     private function getShowLoginConfig($config, $userLoggedIn)
1938 1938
     {
1939
-        return (bool)$config->get('showLoginPanel') && !($userLoggedIn);
1939
+        return (bool) $config->get('showLoginPanel') && !($userLoggedIn);
1940 1940
     }
1941 1941
 
1942 1942
     /**demo
@@ -2295,13 +2295,13 @@  discard block
 block discarded – undo
2295 2295
         /** @var Shopware\Models\Attribute\Payment $payment */
2296 2296
         foreach ($payments as $payment) {
2297 2297
             $paymentObj = $payment->getPayment();
2298
-            if (is_null($paymentObj)){
2298
+            if (is_null($paymentObj)) {
2299 2299
                 $paymentName = false;
2300 2300
             } else {
2301 2301
                 $paymentName = $paymentObj->getName();
2302 2302
             }
2303 2303
             
2304
-            if(!$paymentName){
2304
+            if (!$paymentName) {
2305 2305
                 continue;
2306 2306
             }            
2307 2307
             
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
     {
2380 2380
         $media = $payment->getSwagKlarnaKlarnaMedia();
2381 2381
         if (!$payment->getSwagKlarnaShowInKlarnaIframe() || !empty($media)) {
2382
-            if ($this->assertMinimumVersion('5.1') && version_compare(Shopware::VERSION, '5.2.0', '<=') ) {
2382
+            if ($this->assertMinimumVersion('5.1') && version_compare(Shopware::VERSION, '5.2.0', '<=')) {
2383 2383
                 $media = $this->get('shopware_media.media_service')->getUrl($media);
2384 2384
             } else {
2385 2385
                 /** @var Enlight_Controller_Front $front */
Please login to merge, or discard this patch.
Braces   +28 added lines, -20 removed lines patch added patch discarded remove patch
@@ -250,7 +250,8 @@  discard block
 block discarded – undo
250 250
      * @param void
251 251
      * @return \Klarna
252 252
      */
253
-    public function getKLarnaService() {
253
+    public function getKLarnaService()
254
+    {
254 255
         if ($this->klarnaService === null) {
255 256
             require_once __DIR__ . '/Components/Klarna/Klarna.php';
256 257
             require_once __DIR__ . '/Components/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
@@ -266,7 +267,8 @@  discard block
 block discarded – undo
266 267
      * @param void
267 268
      * @return object
268 269
      */
269
-    public function getKlarnaAddr() {
270
+    public function getKlarnaAddr()
271
+    {
270 272
         if ($this->klarnaAddr === null) {
271 273
             $this->klarnaAddr = new KlarnaAddr();
272 274
         }
@@ -380,7 +382,8 @@  discard block
 block discarded – undo
380 382
      * @param Enlight_Hook_HookArgs $args
381 383
      * @return void
382 384
      */
383
-    public function onBackendOrderSaveAfter(Enlight_Hook_HookArgs $args) {
385
+    public function onBackendOrderSaveAfter(Enlight_Hook_HookArgs $args)
386
+    {
384 387
         $orderDataRaw = $args->getSubject()->Request()->getPost();
385 388
         $orderId = $orderDataRaw['id'];
386 389
         $paymentName = $orderDataRaw['payment'][0]['name'];
@@ -433,7 +436,8 @@  discard block
 block discarded – undo
433 436
      * @param Enlight_Hook_HookArgs $args
434 437
      * @return void
435 438
      */
436
-    public function onBackendOrderDeleteAfter(Enlight_Hook_HookArgs $args) {
439
+    public function onBackendOrderDeleteAfter(Enlight_Hook_HookArgs $args)
440
+    {
437 441
         $orderDataRaw = $args->getSubject()->Request()->getPost();
438 442
         $paymentName = $orderDataRaw['payment'][0]['name'];
439 443
         
@@ -492,7 +496,7 @@  discard block
 block discarded – undo
492 496
     }
493 497
 
494 498
      public function onGetStreetSplitService()
495
-    {
499
+     {
496 500
         $this->Application()->Loader()->registerNamespace(
497 501
             'Shopware\Components',
498 502
             __DIR__ . '/Components/'
@@ -509,7 +513,8 @@  discard block
 block discarded – undo
509 513
      * @param mixed $mPrintableElement
510 514
      * @return void
511 515
      */
512
-    public function klarnaLog($message, $logLevelMessage=1, $mPrintableElement=null) {
516
+    public function klarnaLog($message, $logLevelMessage=1, $mPrintableElement=null)
517
+    {
513 518
         $configname = 'klarnaLogLevel';
514 519
         $elementId = Shopware()->Db()->fetchOne('SELECT id FROM s_core_config_elements WHERE name = ?', [$configname]);
515 520
         $logLevelConfigSetting = Shopware()->Db()->fetchOne('SELECT value FROM s_core_config_values WHERE element_id = ?', [$elementId]);
@@ -541,7 +546,8 @@  discard block
 block discarded – undo
541 546
      * @param array $orderDataRaw
542 547
      * @param string $type
543 548
      */
544
-    protected function getKlarnaAddrByRawOrderData($orderDataRaw, $type) {
549
+    protected function getKlarnaAddrByRawOrderData($orderDataRaw, $type)
550
+    {
545 551
         $klarnaAddr = false;
546 552
         $baseData = (isset($orderDataRaw[$type][0])) ? $orderDataRaw[$type][0] : false;
547 553
         $baseData = $this->convertEncoding($baseData);
@@ -581,7 +587,8 @@  discard block
 block discarded – undo
581 587
      * @param array $baseData
582 588
      * @return array
583 589
      */
584
-    protected function fetchStreetAndHouseNumber($baseData) {
590
+    protected function fetchStreetAndHouseNumber($baseData)
591
+    {
585 592
 
586 593
         $addressParts = explode(' ', $baseData['street']);
587 594
         $index = 0;
@@ -597,10 +604,11 @@  discard block
 block discarded – undo
597 604
             $index++;
598 605
             if ($index == count($addressParts) || $houseNumberFound) {
599 606
                 // at least last element should be streetnr
600
-                if (!empty($streetnr)) $streetnr .= ' ';
607
+                if (!empty($streetnr)) {
608
+                    $streetnr .= ' ';
609
+                }
601 610
                 $streetnr .= (string)$addressPart;
602
-            }
603
-            else  {
611
+            } else {
604 612
                 $street .= (string)' '.$addressPart;
605 613
             }
606 614
         }
@@ -629,7 +637,8 @@  discard block
 block discarded – undo
629 637
      * @param array $data
630 638
      * @return array
631 639
      */
632
-    protected function convertEncoding($data) {
640
+    protected function convertEncoding($data)
641
+    {
633 642
         $out = array();
634 643
         foreach ($data as $key=>$value) {
635 644
             if (is_string($value)) {
@@ -1289,7 +1298,7 @@  discard block
 block discarded – undo
1289 1298
 
1290 1299
         // just return in case kco payment is deactivated in backend
1291 1300
 
1292
-        if (!$this->isKcoPaymentActive()){
1301
+        if (!$this->isKcoPaymentActive()) {
1293 1302
             return;
1294 1303
         }
1295 1304
         $user = $view->getAssign('sUserData');
@@ -1329,7 +1338,7 @@  discard block
 block discarded – undo
1329 1338
             $view->assign('KlarnaMerchantId', $config->get('merchantId'));
1330 1339
             $view->assign('KlarnaHideCheckoutSteps', true);
1331 1340
             
1332
-            if (version_compare(Shopware::VERSION, '5.2.0', '<')){
1341
+            if (version_compare(Shopware::VERSION, '5.2.0', '<')) {
1333 1342
                 $view->assign('KlarnaSkipLoginFix', true);
1334 1343
             }
1335 1344
             if (!$this->isTemplateResponsive()) {
@@ -1449,7 +1458,7 @@  discard block
 block discarded – undo
1449 1458
             $userData['additional']
1450 1459
         );
1451 1460
         
1452
-        if (isset($session['sChangedCountry'])){
1461
+        if (isset($session['sChangedCountry'])) {
1453 1462
             
1454 1463
             /** @var \Shopware\Components\Model\ModelManager $em */
1455 1464
             $em = $this->get('models');
@@ -1545,8 +1554,7 @@  discard block
 block discarded – undo
1545 1554
             // compatibility to shopware plugin custom products
1546 1555
             if (isset($basketItem['custom_product_prices'])) {
1547 1556
                 $basketItemPrice = (double)$basketItem['custom_product_prices']['total'];
1548
-            }
1549
-            else {
1557
+            } else {
1550 1558
                 $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']);
1551 1559
             }
1552 1560
             $unitPrice = round($basketItemPrice * 100);
@@ -1654,7 +1662,7 @@  discard block
 block discarded – undo
1654 1662
         }
1655 1663
 
1656 1664
         // Make sure phone number is unset if empty
1657
-        if ($address['phone'] === null){
1665
+        if ($address['phone'] === null) {
1658 1666
             unset($address['phone']);
1659 1667
         }
1660 1668
         return $address;
@@ -2295,13 +2303,13 @@  discard block
 block discarded – undo
2295 2303
         /** @var Shopware\Models\Attribute\Payment $payment */
2296 2304
         foreach ($payments as $payment) {
2297 2305
             $paymentObj = $payment->getPayment();
2298
-            if (is_null($paymentObj)){
2306
+            if (is_null($paymentObj)) {
2299 2307
                 $paymentName = false;
2300 2308
             } else {
2301 2309
                 $paymentName = $paymentObj->getName();
2302 2310
             }
2303 2311
             
2304
-            if(!$paymentName){
2312
+            if(!$paymentName) {
2305 2313
                 continue;
2306 2314
             }            
2307 2315
             
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
 
1679 1679
     /**
1680 1680
      *
1681
-     * @return array
1681
+     * @return string
1682 1682
      */
1683 1683
     public function getLabel()
1684 1684
     {
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 
1769 1769
     /**
1770 1770
      * @param string $requiredVersion
1771
-     * @return bool|mixed
1771
+     * @return boolean
1772 1772
      */
1773 1773
     protected function assertMinimumVersion($requiredVersion)
1774 1774
     {
@@ -1932,6 +1932,7 @@  discard block
 block discarded – undo
1932 1932
      *
1933 1933
      * @param $config Enlight_Config
1934 1934
      * @param $lastName string
1935
+     * @param boolean $userLoggedIn
1935 1936
      * @return bool
1936 1937
      */
1937 1938
     private function getShowLoginConfig($config, $userLoggedIn)
@@ -2035,7 +2036,7 @@  discard block
 block discarded – undo
2035 2036
      * Helper method to get the correct order for the elements
2036 2037
      *
2037 2038
      * @param $config Enlight_Config
2038
-     * @return array Array with the order of the elements
2039
+     * @return string[] Array with the order of the elements
2039 2040
      */
2040 2041
     private function getPositionOrder($config)
2041 2042
     {
@@ -2339,7 +2340,7 @@  discard block
 block discarded – undo
2339 2340
     /**
2340 2341
      * @param Shopware\Models\Payment\Payment $payment
2341 2342
      * @param $basket
2342
-     * @return bool
2343
+     * @return double
2343 2344
      */
2344 2345
     private function getFee($payment, $basket)
2345 2346
     {
Please login to merge, or discard this patch.
Controllers/Backend/PaymentKlarna.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,6 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
     /**
45 45
      * {@inheritdoc}
46
+     * @param string $name
46 47
      */
47 48
     public function get($name)
48 49
     {
@@ -634,7 +635,7 @@  discard block
 block discarded – undo
634 635
 
635 636
 
636 637
     /**
637
-     * @return array
638
+     * @return string[]
638 639
      */
639 640
     public function getWhitelistedCSRFActions()
640 641
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -449,7 +449,7 @@
 block discarded – undo
449 449
         $orderId = $this->Request()->getParam('orderId');
450 450
         $this->registerShopByOrderId($orderId);
451 451
         $order = $this->getOrderById($orderId);
452
-        $value = (float)str_replace(',', '.', $this->Request()->getParam('value'));
452
+        $value = (float) str_replace(',', '.', $this->Request()->getParam('value'));
453 453
         $service = $this->getService($order);
454 454
 
455 455
         /** @noinspection PhpUndefinedMethodInspection */
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
         $order = $this->orderRepository->find($orderId);
103 103
         if ($order === null) {
104
-            throw new \Exception("Order {$orderId} not found");
104
+            throw new \Exception("order {$orderId} not found");
105 105
         }
106 106
         $shopId = $order->getLanguageIso();
107 107
         if ($shopId === null) {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             $shop = $repository->getActiveById($shopId);
111 111
         }
112 112
         if ($shop === null) {
113
-            throw new \Exception("Shop {$shopId} not found");
113
+            throw new \Exception("shop {$shopId} not found");
114 114
         }
115 115
         $shop->registerResources(Shopware()->Bootstrap());
116 116
         $this->modelManager->clear();
Please login to merge, or discard this patch.
Controllers/Frontend/PaymentKlarna.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -42,6 +42,7 @@
 block discarded – undo
42 42
 
43 43
     /**
44 44
      * {@inheritdoc}
45
+     * @param string $name
45 46
      */
46 47
     public function get($name)
47 48
     {
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     public function showIframeAction()
131 131
     {
132 132
         $this->basket = $this->get('modules')->Basket()->sGetBasket();
133
-         $preFill = $this->config['preFillCheckout'];
133
+            $preFill = $this->config['preFillCheckout'];
134 134
         if ($this->isUserLoggedIn()) {
135 135
             $user = Shopware()->Modules()->Admin()->sGetUserData();
136 136
         }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
         // Klarna Prefill checkBox
290 290
         if ($this->isUserLoggedIn()) {
291
-               $this->View()->assign('KlarnaPreFillSelect', !$this->session['klarnaPreFill']);
291
+                $this->View()->assign('KlarnaPreFillSelect', !$this->session['klarnaPreFill']);
292 292
         }
293 293
 
294 294
         // Iframe Backend Config
@@ -702,8 +702,8 @@  discard block
 block discarded – undo
702 702
                     }
703 703
                     $module->sSYSTEM->_POST = $data['billing'];
704 704
                     if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) {
705
-                         $userId = $session->offsetGet('sUserId');
706
-                         $this->updateBilling($userId, $data['billing']);
705
+                            $userId = $session->offsetGet('sUserId');
706
+                            $this->updateBilling($userId, $data['billing']);
707 707
                     } else {
708 708
                         $module->sUpdateBilling();
709 709
                     }
@@ -883,12 +883,12 @@  discard block
 block discarded – undo
883 883
     }
884 884
 
885 885
 
886
-     /**
887
-     * Updates the shipping address
888
-     *
889
-     * @param int $userId
890
-     * @param array $shippingData
891
-     */
886
+        /**
887
+         * Updates the shipping address
888
+         *
889
+         * @param int $userId
890
+         * @param array $shippingData
891
+         */
892 892
     private function updateShipping($userId, $shippingData)
893 893
     {
894 894
         /** @var \Shopware\Components\Model\ModelManager $em */
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
         $addressold = $customer->getDefaultShippingAddress();
902 902
         $address = new \Shopware\Models\Customer\Address();
903 903
         
904
-         /** @var \Shopware\Models\Country\Country $country */
904
+            /** @var \Shopware\Models\Country\Country $country */
905 905
         $country = $addressold->getCountry();
906 906
         $shippingData['country'] = $country;
907 907
         if ($shippingData['phone'] === null) {
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
         /** @var \Shopware\Models\Customer\Address $address */
938 938
         $address = $customer->getDefaultBillingAddress();
939 939
         
940
-         /** @var \Shopware\Models\Country\Country $country */
940
+            /** @var \Shopware\Models\Country\Country $country */
941 941
         $country = $address->getCountry();
942 942
         $billingData['country'] = $country;
943 943
         $address->fromArray($billingData);
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
      */
1513 1513
     protected function isUserLoggedIn()
1514 1514
     {
1515
-         return (isset($this->session->sUserId) && !empty($this->session->sUserId));
1515
+            return (isset($this->session->sUserId) && !empty($this->session->sUserId));
1516 1516
     }
1517 1517
 
1518 1518
     /**
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
         }
113 113
         
114 114
         if ($this->Request()->getPost('sCountry')) {
115
-            $this->session['sCountry'] = (int)$this->Request()->getPost('sCountry');
115
+            $this->session['sCountry'] = (int) $this->Request()->getPost('sCountry');
116 116
             $this->session["sState"] = 0;
117 117
             $this->session["sArea"] = Shopware()->Db()->fetchOne("
118 118
                 SELECT areaID FROM s_core_countries WHERE id = ?
119 119
             ", [$this->session['sCountry']]);
120 120
             unset($this->session->KlarnaOrder);
121
-            $this->session['sChangedCountry'] = (int)$this->Request()->getPost('sCountry');
121
+            $this->session['sChangedCountry'] = (int) $this->Request()->getPost('sCountry');
122 122
         }
123 123
         $this->forward('index');
124 124
     }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                     $this->redirect(['controller' => 'payment_klarna', 'action' => 'otherPayment']);
159 159
                     return;
160 160
                 }
161
-                $shopCountryId = (string)$shopCountryId;
161
+                $shopCountryId = (string) $shopCountryId;
162 162
                 if ($shopCountryId != $postedCountry) {
163 163
                     $this->session['sCountry'] = $postedCountry;
164 164
                     // unset klarnaOrder so it will be created with new countryID
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
 
314 314
         $this->basket['sAmountTax'] = 1.9;
315 315
         $this->View()->sShippingcosts = $debugShipping['brutto'];
316
-        $this->View()->sShippingcostsWithTax =  $debugShipping['brutto'];
316
+        $this->View()->sShippingcostsWithTax = $debugShipping['brutto'];
317 317
         $this->View()->sShippingcostsNet = $debugShipping['netto'];
318 318
         $this->View()->sShippingcostsTax = $debugShipping['tax'];
319
-        $this->View()->sAmount = $this->basket['AmountWithTaxNumeric'] ;
319
+        $this->View()->sAmount = $this->basket['AmountWithTaxNumeric'];
320 320
 
321 321
         $this->View()->sAmountNet = $this->basket['sAmountNet'];
322 322
         $this->View()->sAmountTax = $this->basket['sAmountTax'];
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
                         );
791 791
                     }
792 792
                 } catch (\Exception $ex) { /* do nothing */
793
-                    $this->plugin->klarnaLog("ERROR while creating User. Exception information:". $ex->getMessage(), 1);
793
+                    $this->plugin->klarnaLog("ERROR while creating User. Exception information:" . $ex->getMessage(), 1);
794 794
                 }
795 795
             }
796 796
         }
@@ -1036,8 +1036,8 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
                 $update['status'] = 'created';
1038 1038
                 $update['merchant_reference'] = [
1039
-                    'orderid1' => (string)$orderNumber,
1040
-                    'orderid2' => (string)$order['reference']
1039
+                    'orderid1' => (string) $orderNumber,
1040
+                    'orderid2' => (string) $order['reference']
1041 1041
                 ];
1042 1042
                 $order->update($update);
1043 1043
             }
@@ -1366,8 +1366,8 @@  discard block
 block discarded – undo
1366 1366
 
1367 1367
             $update['status'] = 'created';
1368 1368
             $update['merchant_reference'] = [
1369
-                'orderid1' => (string)$orderNumber,
1370
-                'orderid2' => (string)$order['reference']
1369
+                'orderid1' => (string) $orderNumber,
1370
+                'orderid2' => (string) $order['reference']
1371 1371
             ];
1372 1372
             $order->update($update);
1373 1373
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -789,7 +789,8 @@
 block discarded – undo
789 789
                             $session->offsetGet('sRegisterFinished')
790 790
                         );
791 791
                     }
792
-                } catch (\Exception $ex) { /* do nothing */
792
+                } catch (\Exception $ex) {
793
+/* do nothing */
793 794
                     $this->plugin->klarnaLog("ERROR while creating User. Exception information:". $ex->getMessage(), 1);
794 795
                 }
795 796
             }
Please login to merge, or discard this patch.