Code Duplication    Length = 9-12 lines in 2 locations

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

@@ 1415-1426 (lines=12) @@
1412
     * @param int $itemId The item ID
1413
     * @return array The beneficiaries. Otherwise return false
1414
     */
1415
    public function getItemBeneficiaries($itemId)
1416
    {
1417
        $beneficiaryTable = Database::get_main_table(self::TABLE_ITEM_BENEFICIARY);
1418
1419
        return Database::select(
1420
            '*',
1421
            $beneficiaryTable,
1422
            ['where' => [
1423
                'item_id = ?' => intval($itemId)
1424
            ]]
1425
        );
1426
    }
1427
1428
    /**
1429
     * Delete a item with its beneficiaries
@@ 1486-1494 (lines=9) @@
1483
     * @param int $itemId The user ID
1484
     * @return int The number of affected rows. Otherwise return false
1485
     */
1486
    public function deleteItemBeneficiaries($itemId)
1487
    {
1488
        $beneficiaryTable = Database::get_main_table(self::TABLE_ITEM_BENEFICIARY);
1489
1490
        return Database::delete(
1491
            $beneficiaryTable,
1492
            ['item_id = ?' => intval($itemId)]
1493
        );
1494
    }
1495
1496
    /**
1497
     * Register the beneficiaries users with the sale of item