Code Duplication    Length = 9-13 lines in 3 locations

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

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