Code Duplication    Length = 14-16 lines in 2 locations

main/newscorm/learnpath.class.php 2 locations

@@ 10426-10441 (lines=16) @@
10423
     * Get the items of exercise type
10424
     * @return array The items. Otherwise return false
10425
     */
10426
    public function getExercisesItems()
10427
    {
10428
        $exercises = [];
10429
10430
        foreach ($this->items as $item) {
10431
            if ($item->type != 'quiz') {
10432
                continue;
10433
            }
10434
10435
            $exercises[] = $item;
10436
        }
10437
10438
        array_pop($exercises);
10439
10440
        return $exercises;
10441
    }
10442
10443
    /**
10444
     * Get the item of exercise type (evaluation type)
@@ 10447-10460 (lines=14) @@
10444
     * Get the item of exercise type (evaluation type)
10445
     * @return array The final evaluation. Otherwise return false
10446
     */
10447
    public function getFinalEvaluationItem()
10448
    {
10449
        $exercises = [];
10450
10451
        foreach ($this->items as $item) {
10452
            if ($item->type != 'quiz') {
10453
                continue;
10454
            }
10455
10456
            $exercises[] = $item;
10457
        }
10458
10459
        return array_pop($exercises);
10460
    }
10461
10462
    /**
10463
     * Calculate the total points achieved for the current user in this learning path