Code Duplication    Length = 21-21 lines in 2 locations

Components/PriceGateway.php 2 locations

@@ 37-57 (lines=21) @@
34
     * @throws \Zend_Db_Statement_Exception
35
     * @return array
36
     */
37
    public function countProductsWithoutConfiguredPrice(Group $group = null, $priceField)
38
    {
39
        if ($priceField == 'detailPurchasePrice') {
40
            $query = $this->db->query('
41
                SELECT COUNT(sad.id)
42
                FROM s_articles_details sad
43
                LEFT JOIN s_plugin_connect_items spci ON sad.id = spci.article_detail_id
44
                WHERE spci.shop_id IS NULL AND sad.purchaseprice = 0
45
            ');
46
        } else {
47
            $query = $this->db->query("
48
                SELECT COUNT(sad.id)
49
                FROM s_articles_details sad
50
                LEFT JOIN s_articles_prices sap ON sad.id = sap.articledetailsID AND sap.pricegroup = ?
51
                LEFT JOIN s_plugin_connect_items spci ON sad.id = spci.article_detail_id
52
                WHERE spci.shop_id IS NULL AND sap.{$priceField} IS NULL OR sap.{$priceField} = 0
53
            ", [$group->getKey()]);
54
        }
55
56
        return (int) $query->fetchColumn();
57
    }
58
59
    /**
60
     * Returns count of product with
@@ 68-88 (lines=21) @@
65
     * @throws \Zend_Db_Statement_Exception
66
     * @return array
67
     */
68
    public function countProductsWithConfiguredPrice(Group $group = null, $priceField)
69
    {
70
        if ($priceField == 'detailPurchasePrice') {
71
            $query = $this->db->query('
72
                SELECT COUNT(sad.id)
73
                FROM s_articles_details sad
74
                LEFT JOIN s_plugin_connect_items spci ON sad.id = spci.article_detail_id
75
                WHERE spci.shop_id IS NULL AND sad.purchaseprice > 0
76
            ');
77
        } else {
78
            $query = $this->db->query("
79
                SELECT COUNT(sad.id)
80
                FROM s_articles_details sad
81
                LEFT JOIN s_articles_prices sap ON sad.id = sap.articledetailsID AND sap.pricegroup = ?
82
                LEFT JOIN s_plugin_connect_items spci ON sad.id = spci.article_detail_id
83
                WHERE spci.shop_id IS NULL AND sap.{$priceField} IS NOT NULL AND sap.{$priceField} > 0
84
            ", [$group->getKey()]);
85
        }
86
87
        return (int) $query->fetchColumn();
88
    }
89
90
    /**
91
     * Returns count of product including variants for a group