Code Duplication    Length = 9-12 lines in 2 locations

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

@@ 1437-1448 (lines=12) @@
1434
     * @param int $itemId The item ID
1435
     * @return array The beneficiaries. Otherwise return false
1436
     */
1437
    public function getItemBeneficiaries($itemId)
1438
    {
1439
        $beneficiaryTable = Database::get_main_table(self::TABLE_ITEM_BENEFICIARY);
1440
1441
        return Database::select(
1442
            '*',
1443
            $beneficiaryTable,
1444
            ['where' => [
1445
                'item_id = ?' => intval($itemId),
1446
            ]]
1447
        );
1448
    }
1449
1450
    /**
1451
     * Delete a item with its beneficiaries
@@ 1508-1516 (lines=9) @@
1505
     * @param int $itemId The user ID
1506
     * @return int The number of affected rows. Otherwise return false
1507
     */
1508
    public function deleteItemBeneficiaries($itemId)
1509
    {
1510
        $beneficiaryTable = Database::get_main_table(self::TABLE_ITEM_BENEFICIARY);
1511
1512
        return Database::delete(
1513
            $beneficiaryTable,
1514
            ['item_id = ?' => intval($itemId)]
1515
        );
1516
    }
1517
1518
    /**
1519
     * Register the beneficiaries users with the sale of item