Code Duplication    Length = 14-16 lines in 2 locations

main/newscorm/learnpath.class.php 2 locations

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