Code Duplication    Length = 9-13 lines in 3 locations

plugin/buycourses/src/buy_course_plugin.class.php 3 locations

@@ 1415-1427 (lines=13) @@
1412
     * @param int $productType The type of product
1413
     * @return int The number of affected rows. Otherwise return false
1414
     */
1415
    public function updateItem(array $itemData, $productId, $productType)
1416
    {
1417
        $itemTable = Database::get_main_table(BuyCoursesPlugin::TABLE_ITEM);
1418
1419
        return Database::update(
1420
            $itemTable,
1421
            $itemData,
1422
            [
1423
                'product_id = ? AND ' => intval($productId),
1424
                'product_type' => $productType
1425
            ]
1426
        );
1427
    }
1428
1429
    /**
1430
     * Remove all beneficiaries for a item
@@ 1635-1645 (lines=11) @@
1632
     * @param int $status The status to set (-1 to cancel, 0 to pending, 1 to completed)
1633
     * @return array
1634
     */
1635
    public function setStatusPayouts($payoutId, $status)
1636
    {
1637
        $payoutsTable = Database::get_main_table(BuyCoursesPlugin::TABLE_PAYPAL_PAYOUTS);
1638
1639
        Database::update(
1640
            $payoutsTable,
1641
            ['status' => intval($status)],
1642
            ['id = ?' => intval($payoutId)]
1643
        );
1644
1645
    }
1646
1647
    /**
1648
     * Gets the stored platform commission params
@@ 1666-1674 (lines=9) @@
1663
     * @param int $params platform commission
1664
     * @return int The number of affected rows. Otherwise return false
1665
     */
1666
    public function updateCommission($params)
1667
    {
1668
        $commissionTable = Database::get_main_table(BuyCoursesPlugin::TABLE_COMMISSION);
1669
1670
        return Database::update(
1671
            $commissionTable,
1672
            ['commission' => intval($params['commission'])]
1673
        );
1674
    }
1675
1676
    /**
1677
     * Register addicional service