Code Duplication    Length = 13-13 lines in 2 locations

Bootstrap.php 1 location

@@ 1474-1486 (lines=13) @@
1471
     * @param $shop Shopware\Models\Shop\Shop
1472
     * @return int|null
1473
     */
1474
    public function getCountryByShop($shop)
1475
    {
1476
        $locale = $shop->getLocale()->getLocale();
1477
        $this->klarnaLog("Entering Bootstrap::getCountryByShop", 3);
1478
        $locale = explode('_', $locale);
1479
        $locale = isset($locale[1]) ? $locale[1] : $locale[0];
1480
        $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale,3);
1481
        $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?';
1482
        $countryId = Shopware()->Db()->fetchOne($sql, array($locale));
1483
        $countryId = ($countryId) ? (int)$countryId : null;
1484
                
1485
        return $countryId;
1486
    }
1487
1488
    /**
1489
     * Get user country by country id

Controllers/Frontend/PaymentKlarna.php 1 location

@@ 327-339 (lines=13) @@
324
     * @param $shop Shopware\Models\Shop\Shop
325
     * @return int|null
326
     */
327
    public function getCountryByShop($shop)
328
    {
329
        $locale = $shop->getLocale()->getLocale();
330
        $this->plugin->klarnaLog("Entering Bootstrap::getCountryByShop", 3);
331
        $locale = explode('_', $locale);
332
        $locale = isset($locale[1]) ? $locale[1] : $locale[0];
333
        $this->plugin->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale,3);
334
        $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?';
335
        $countryId = Shopware()->Db()->fetchOne($sql, array($locale));
336
        $countryId = ($countryId) ? (int)$countryId : null;
337
338
        return $countryId;
339
    }
340
341
    /**
342
     * Add voucher to cart