Completed
Push — master ( eccdf7...a581ed )
by Mario
03:04
created
Bootstrap.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -506,10 +506,10 @@  discard block
 block discarded – undo
506 506
         $elementId = Shopware()->Db()->fetchOne('SELECT id FROM s_core_config_elements WHERE name = ?', [$configname]);
507 507
         $logLevelConfigSetting = Shopware()->Db()->fetchOne('SELECT value FROM s_core_config_values WHERE element_id = ?', [$elementId]);
508 508
         $logLevelConfigSetting = unserialize($logLevelConfigSetting);
509
-        $logLevelSetting = (is_numeric($logLevelConfigSetting) && $logLevelConfigSetting >=0 && $logLevelConfigSetting <=4) ? (int)$logLevelConfigSetting : 1;
509
+        $logLevelSetting = (is_numeric($logLevelConfigSetting) && $logLevelConfigSetting >= 0 && $logLevelConfigSetting <= 4) ? (int) $logLevelConfigSetting : 1;
510 510
         
511 511
         if ($logLevelMessage <= $logLevelSetting) {
512
-            $prefix = "[".date('Y-m-d H:i:s')."] ";
512
+            $prefix = "[" . date('Y-m-d H:i:s') . "] ";
513 513
             $debugBacktrace = '';
514 514
             if ($logLevelSetting >= 4) {
515 515
                 $debugBacktrace = print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true);
@@ -518,9 +518,9 @@  discard block
 block discarded – undo
518 518
             if ($mPrintableElement !== null) {
519 519
                 $sPrintableElementMessage = print_r($mPrintableElement, true);
520 520
             }
521
-            $fullMessage = $prefix.$message."\n".$sPrintableElementMessage.$debugBacktrace;
521
+            $fullMessage = $prefix . $message . "\n" . $sPrintableElementMessage . $debugBacktrace;
522 522
             $shopPath = Shopware()->DocPath();
523
-            $logfilePath = $shopPath.'/var/log/klarnaTrace.log';
523
+            $logfilePath = $shopPath . '/var/log/klarnaTrace.log';
524 524
             $fileHandler = fopen($logfilePath, 'a');
525 525
             fwrite($fileHandler, $fullMessage);
526 526
             fclose($fileHandler);
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
             $country = $repository->findOneBy(['id' => $baseData['countryId']]);
550 550
             $countryiso = $country->getIso();
551 551
 
552
-            $klarnaAddr =  new KlarnaAddr();
552
+            $klarnaAddr = new KlarnaAddr();
553 553
             $klarnaAddr->setEmail($orderDataRaw['customerEmail']);
554 554
             $klarnaAddr->setFirstName($baseData['firstName']);
555 555
             $klarnaAddr->setLastName($baseData['lastName']);
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
                 }
598 598
                 $streetnr .= (string) $addressPart;
599 599
             } else {
600
-                $street .= (string)' '.$addressPart;
600
+                $street .= (string) ' ' . $addressPart;
601 601
             }
602 602
         }
603 603
 
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
             $streetnr_extension .= $baseData['additionalAddressLine1'];
607 607
         }
608 608
         if (!empty($baseData['additionalAddressLine2'])) {
609
-            $streetnr_extension .= "\n".$baseData['additionalAddressLine2'];
609
+            $streetnr_extension .= "\n" . $baseData['additionalAddressLine2'];
610 610
         }
611 611
 
612 612
         $return = [
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
 
1285 1285
         // just return in case kco payment is deactivated in backend
1286 1286
 
1287
-        if (!$this->isKcoPaymentActive()){
1287
+        if (!$this->isKcoPaymentActive()) {
1288 1288
             return;
1289 1289
         }
1290 1290
         $user = $view->getAssign('sUserData');
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
             && ($request->getActionName() == 'cart' || $request->getActionName() == 'ajaxCart')
1296 1296
         ) {
1297 1297
             $this->registerMyTemplateDir();
1298
-            $view->assign('KlarnaEnableButton', (bool)$config->get('showKlarnaButton'));
1298
+            $view->assign('KlarnaEnableButton', (bool) $config->get('showKlarnaButton'));
1299 1299
             $view->assign('KlarnaShowCheckoutButton', $this->getShowCheckoutButton($user));
1300 1300
             $view->assign('klarnaKcoPaymentActive', $this->isKlarnaKcoPaymentActive($user));
1301 1301
             $view->assign('KlarnaPaymentDescription', $this->getPayment()->getDescription());
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
             $view->assign('KlarnaMerchantId', $config->get('merchantId'));
1325 1325
             $view->assign('KlarnaHideCheckoutSteps', true);
1326 1326
             
1327
-            if (version_compare(Shopware::VERSION, '5.2.0', '<')){
1327
+            if (version_compare(Shopware::VERSION, '5.2.0', '<')) {
1328 1328
                 $view->assign('KlarnaSkipLoginFix', true);
1329 1329
             }
1330 1330
             if (!$this->isTemplateResponsive()) {
@@ -1444,15 +1444,15 @@  discard block
 block discarded – undo
1444 1444
             $userData['additional']
1445 1445
         );
1446 1446
         
1447
-        if (isset($session['sChangedCountry'])){
1447
+        if (isset($session['sChangedCountry'])) {
1448 1448
             
1449 1449
             /** @var \Shopware\Components\Model\ModelManager $em */
1450 1450
             $em = $this->get('models');
1451 1451
 
1452 1452
             /** @var \Shopware\Models\Customer\Customer $customer */
1453 1453
             $country = $em->getRepository('Shopware\Models\Country\Country')->findOneBy(['id' => $session['sChangedCountry']]);
1454
-            $userData['shippingaddress']['country'] =$country;     
1455
-            $userData['billingaddress']['country'] =$country;   
1454
+            $userData['shippingaddress']['country'] = $country;     
1455
+            $userData['billingaddress']['country'] = $country;   
1456 1456
             $userData['shippingaddress']['countryID'] = $session['sChangedCountry'];
1457 1457
             $userData['billingaddress']['countryID'] = $session['sChangedCountry'];
1458 1458
          }
@@ -1472,10 +1472,10 @@  discard block
 block discarded – undo
1472 1472
         $this->klarnaLog("Entering Bootstrap::getCountryByShop", 3);
1473 1473
         $locale = explode('_', $locale);
1474 1474
         $locale = isset($locale[1]) ? $locale[1] : $locale[0];
1475
-        $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale,3);
1475
+        $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:" . $locale, 3);
1476 1476
         $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?';
1477 1477
         $countryId = Shopware()->Db()->fetchOne($sql, [$locale]);
1478
-        $countryId = ($countryId) ? (int)$countryId : null;
1478
+        $countryId = ($countryId) ? (int) $countryId : null;
1479 1479
                 
1480 1480
         return $countryId;
1481 1481
     }
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
         $locale = $locale == 'nn-no' ? 'nb-no' : $locale;
1507 1507
 
1508 1508
         if ($locale == 'de-de') {
1509
-            if($countryIso == 'CH') {
1509
+            if ($countryIso == 'CH') {
1510 1510
                 $locale = 'de-ch';
1511 1511
             } elseif ($countryIso == 'AT') {
1512 1512
                 $locale = 'de-at';
@@ -1521,10 +1521,10 @@  discard block
 block discarded – undo
1521 1521
         $config = $this->Config();
1522 1522
         $options = $this->getColorConfigOptions($config);
1523 1523
 
1524
-        $options['allow_separate_shipping_address'] = (bool)$config->get('allowSeparateShippingAddress');
1525
-        $options['packstation_enabled'] = (bool)$config->get('supportPackstation') && $allowPackstation;
1526
-        $options['phone_mandatory'] = (bool)$config->get('mandatoryPhone');
1527
-        $options['date_of_birth_mandatory'] = (bool)$config->get('mandatoryBirthday');
1524
+        $options['allow_separate_shipping_address'] = (bool) $config->get('allowSeparateShippingAddress');
1525
+        $options['packstation_enabled'] = (bool) $config->get('supportPackstation') && $allowPackstation;
1526
+        $options['phone_mandatory'] = (bool) $config->get('mandatoryPhone');
1527
+        $options['date_of_birth_mandatory'] = (bool) $config->get('mandatoryBirthday');
1528 1528
 
1529 1529
         if (!empty($dispatch)) {
1530 1530
             $options['shipping_details'] = $dispatch['description'];
@@ -1539,19 +1539,19 @@  discard block
 block discarded – undo
1539 1539
         foreach ($basket['content'] as $index=>$basketItem) {
1540 1540
             // compatibility to shopware plugin custom products
1541 1541
             if (isset($basketItem['custom_product_prices'])) {
1542
-                $basketItemPrice = (double)$basketItem['custom_product_prices']['total'];
1542
+                $basketItemPrice = (double) $basketItem['custom_product_prices']['total'];
1543 1543
             }
1544 1544
             else {
1545
-                $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']);
1545
+                $basketItemPrice = (double) str_replace(',', '.', $basketItem['price']);
1546 1546
             }
1547 1547
             $unitPrice = round($basketItemPrice * 100);
1548 1548
             $cart[] = [
1549 1549
                 'type' => $unitPrice >= 0 ? 'physical' : 'discount',
1550 1550
                 'reference' => $basketItem['ordernumber'],
1551 1551
                 'name' => $basketItem['articlename'],
1552
-                'quantity' => (int)$basketItem['quantity'],
1553
-                'unit_price' => (int)$unitPrice,
1554
-                'tax_rate' => (int)round($basketItem['tax_rate'] * 100)
1552
+                'quantity' => (int) $basketItem['quantity'],
1553
+                'unit_price' => (int) $unitPrice,
1554
+                'tax_rate' => (int) round($basketItem['tax_rate'] * 100)
1555 1555
             ];
1556 1556
         }
1557 1557
         if (!empty($basket['sShippingcosts'])) {
@@ -1562,8 +1562,8 @@  discard block
 block discarded – undo
1562 1562
                 'reference' => 'SHIPPING',
1563 1563
                 'name' => 'Shipping Fee',
1564 1564
                 'quantity' => 1,
1565
-                'unit_price' => (int)round($shippingAmount * 100),
1566
-                'tax_rate' => (int)round($basket['sShippingcostsTax'] * 100),
1565
+                'unit_price' => (int) round($shippingAmount * 100),
1566
+                'tax_rate' => (int) round($basket['sShippingcostsTax'] * 100),
1567 1567
             ];
1568 1568
         }
1569 1569
 
@@ -1649,7 +1649,7 @@  discard block
 block discarded – undo
1649 1649
         }
1650 1650
 
1651 1651
         // Make sure phone number is unset if empty
1652
-        if ($address['phone'] === null){
1652
+        if ($address['phone'] === null) {
1653 1653
             unset($address['phone']);
1654 1654
         }
1655 1655
         return $address;
@@ -1838,9 +1838,9 @@  discard block
 block discarded – undo
1838 1838
         $view->assign('sPayments', $this->filterPayments($adminModule->sGetPaymentMeans()));
1839 1839
         $view->assign('sCountryList', $adminModule->sGetCountryList());
1840 1840
         $view->assign('KlarnaHideCheckoutSteps', true);
1841
-        $view->assign('KlarnaShowB2bSelect', (bool)$config->get('showB2bSelect'));
1842
-        $view->assign('KlarnaShowBasket', (bool)$config->get('showMiniBasket'));
1843
-        $view->assign('KlarnaShowDispatch', (bool)$config->get('showDispatch'));
1841
+        $view->assign('KlarnaShowB2bSelect', (bool) $config->get('showB2bSelect'));
1842
+        $view->assign('KlarnaShowBasket', (bool) $config->get('showMiniBasket'));
1843
+        $view->assign('KlarnaShowDispatch', (bool) $config->get('showDispatch'));
1844 1844
         $view->assign(
1845 1845
             'KlarnaCDNLink',
1846 1846
             $this->buildCDNLink()
Please login to merge, or discard this patch.