Code Duplication    Length = 9-12 lines in 2 locations

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

@@ 1355-1366 (lines=12) @@
1352
     * @param int $itemId The item ID
1353
     * @return array The beneficiries. Otherwise return false
1354
     */
1355
    public function getItemBeneficiaries($itemId)
1356
    {
1357
        $beneficiaryTable = Database::get_main_table(self::TABLE_ITEM_BENEFICIARY);
1358
1359
        return Database::select(
1360
            '*',
1361
            $beneficiaryTable,
1362
            ['where' => [
1363
                'item_id = ?' => intval($itemId)
1364
            ]]
1365
        );
1366
    }
1367
1368
    /**
1369
     * Delete a item with its beneficiaries
@@ 1427-1435 (lines=9) @@
1424
     * @param int $itemId The user ID
1425
     * @return int The number of affected rows. Otherwise return false
1426
     */
1427
    public function deleteItemBeneficiaries($itemId)
1428
    {
1429
        $beneficiaryTable = Database::get_main_table(BuyCoursesPlugin::TABLE_ITEM_BENEFICIARY);
1430
1431
        return Database::delete(
1432
            $beneficiaryTable,
1433
            ['item_id = ?' => intval($itemId)]
1434
        );
1435
    }
1436
1437
    /**
1438
     * Register the beneficiaries users with the sale of item