@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | * |
| 533 | 533 | * @param array $orderDataRaw |
| 534 | 534 | * @param string $type |
| 535 | - * @return bool|KlarnaAddr |
|
| 535 | + * @return KlarnaAddr |
|
| 536 | 536 | */ |
| 537 | 537 | protected function getKlarnaAddrByRawOrderData($orderDataRaw, $type) |
| 538 | 538 | { |
@@ -1710,7 +1710,7 @@ discard block |
||
| 1710 | 1710 | /** |
| 1711 | 1711 | * Creates and returns the klarna client for an event. |
| 1712 | 1712 | * |
| 1713 | - * @return \Klarna_Checkout_Connector |
|
| 1713 | + * @return Klarna_Checkout_ConnectorInterface |
|
| 1714 | 1714 | */ |
| 1715 | 1715 | public function onInitResourceKlarnaCheckoutConnector() |
| 1716 | 1716 | { |
@@ -1760,7 +1760,7 @@ discard block |
||
| 1760 | 1760 | |
| 1761 | 1761 | /** |
| 1762 | 1762 | * @param string $requiredVersion |
| 1763 | - * @return bool|mixed |
|
| 1763 | + * @return boolean |
|
| 1764 | 1764 | */ |
| 1765 | 1765 | protected function assertMinimumVersion($requiredVersion) |
| 1766 | 1766 | { |
@@ -1867,7 +1867,7 @@ discard block |
||
| 1867 | 1867 | * Helper method to get the config whether or not to show the login-panel in the klarna-checkout. |
| 1868 | 1868 | * |
| 1869 | 1869 | * @param Enlight_Config $config |
| 1870 | - * @param $userLoggedIn |
|
| 1870 | + * @param boolean $userLoggedIn |
|
| 1871 | 1871 | * @return bool |
| 1872 | 1872 | */ |
| 1873 | 1873 | private function getShowLoginConfig($config, $userLoggedIn) |
@@ -1927,7 +1927,7 @@ discard block |
||
| 1927 | 1927 | * Helper method to get the correct order for the elements |
| 1928 | 1928 | * |
| 1929 | 1929 | * @param $config Enlight_Config |
| 1930 | - * @return array Array with the order of the elements |
|
| 1930 | + * @return string[] Array with the order of the elements |
|
| 1931 | 1931 | */ |
| 1932 | 1932 | private function getPositionOrder($config) |
| 1933 | 1933 | { |
@@ -2232,7 +2232,7 @@ discard block |
||
| 2232 | 2232 | /** |
| 2233 | 2233 | * @param Shopware\Models\Payment\Payment $payment |
| 2234 | 2234 | * @param $basket |
| 2235 | - * @return bool |
|
| 2235 | + * @return double |
|
| 2236 | 2236 | */ |
| 2237 | 2237 | private function getFee($payment, $basket) |
| 2238 | 2238 | { |
@@ -1359,12 +1359,12 @@ discard block |
||
| 1359 | 1359 | /** @var Enlight_Components_Session_Namespace $session */ |
| 1360 | 1360 | $session = $this->Application()->Session(); |
| 1361 | 1361 | |
| 1362 | - // Switch User to external PaymentId after registration |
|
| 1363 | - if (isset($session['KlarnaExternalPaymentId'])) { |
|
| 1362 | + // Switch User to external PaymentId after registration |
|
| 1363 | + if (isset($session['KlarnaExternalPaymentId'])) { |
|
| 1364 | 1364 | $this->savePayment($session['KlarnaExternalPaymentId']); |
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 1367 | - $view->assign('klarnaRedirect', $request->has('klarnaRedirect') && $request->getParam('klarnaRedirect') == 1); |
|
| 1367 | + $view->assign('klarnaRedirect', $request->has('klarnaRedirect') && $request->getParam('klarnaRedirect') == 1); |
|
| 1368 | 1368 | } |
| 1369 | 1369 | |
| 1370 | 1370 | |
@@ -1455,7 +1455,7 @@ discard block |
||
| 1455 | 1455 | $userData['billingaddress']['country'] =$country; |
| 1456 | 1456 | $userData['shippingaddress']['countryID'] = $session['sChangedCountry']; |
| 1457 | 1457 | $userData['billingaddress']['countryID'] = $session['sChangedCountry']; |
| 1458 | - } |
|
| 1458 | + } |
|
| 1459 | 1459 | |
| 1460 | 1460 | $orderVariables['sUserData'] = $userData; |
| 1461 | 1461 | $testbreakpoint = 0; |
@@ -506,10 +506,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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() |
@@ -1284,7 +1284,7 @@ discard block |
||
| 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'); |
@@ -1324,7 +1324,7 @@ discard block |
||
| 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,7 +1444,7 @@ discard block |
||
| 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'); |
@@ -1540,8 +1540,7 @@ discard block |
||
| 1540 | 1540 | // compatibility to shopware plugin custom products |
| 1541 | 1541 | if (isset($basketItem['custom_product_prices'])) { |
| 1542 | 1542 | $basketItemPrice = (double)$basketItem['custom_product_prices']['total']; |
| 1543 | - } |
|
| 1544 | - else { |
|
| 1543 | + } else { |
|
| 1545 | 1544 | $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']); |
| 1546 | 1545 | } |
| 1547 | 1546 | $unitPrice = round($basketItemPrice * 100); |
@@ -1649,7 +1648,7 @@ discard block |
||
| 1649 | 1648 | } |
| 1650 | 1649 | |
| 1651 | 1650 | // Make sure phone number is unset if empty |
| 1652 | - if ($address['phone'] === null){ |
|
| 1651 | + if ($address['phone'] === null) { |
|
| 1653 | 1652 | unset($address['phone']); |
| 1654 | 1653 | } |
| 1655 | 1654 | return $address; |
@@ -43,6 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * {@inheritdoc} |
| 46 | + * @param string $name |
|
| 46 | 47 | */ |
| 47 | 48 | public function get($name) |
| 48 | 49 | { |
@@ -117,6 +118,9 @@ discard block |
||
| 117 | 118 | return $shop; |
| 118 | 119 | } |
| 119 | 120 | |
| 121 | + /** |
|
| 122 | + * @param string $statusType |
|
| 123 | + */ |
|
| 120 | 124 | private function getOrderPaymentStatus($statusType) |
| 121 | 125 | { |
| 122 | 126 | $paymentStatus = $this->plugin->Config()->get($statusType); |
@@ -633,7 +637,7 @@ discard block |
||
| 633 | 637 | |
| 634 | 638 | |
| 635 | 639 | /** |
| 636 | - * @return array |
|
| 640 | + * @return string[] |
|
| 637 | 641 | */ |
| 638 | 642 | public function getWhitelistedCSRFActions() |
| 639 | 643 | { |