Code Duplication    Length = 14-16 lines in 2 locations

main/newscorm/learnpath.class.php 2 locations

@@ 10520-10535 (lines=16) @@
10517
     * Get the items of exercise type
10518
     * @return array The items. Otherwise return false
10519
     */
10520
    public function getExercisesItems()
10521
    {
10522
        $exercises = [];
10523
10524
        foreach ($this->items as $item) {
10525
            if ($item->type != 'quiz') {
10526
                continue;
10527
            }
10528
10529
            $exercises[] = $item;
10530
        }
10531
10532
        array_pop($exercises);
10533
10534
        return $exercises;
10535
    }
10536
10537
    /**
10538
     * Get the item of exercise type (evaluation type)
@@ 10541-10554 (lines=14) @@
10538
     * Get the item of exercise type (evaluation type)
10539
     * @return array The final evaluation. Otherwise return false
10540
     */
10541
    public function getFinalEvaluationItem()
10542
    {
10543
        $exercises = [];
10544
10545
        foreach ($this->items as $item) {
10546
            if ($item->type != 'quiz') {
10547
                continue;
10548
            }
10549
10550
            $exercises[] = $item;
10551
        }
10552
10553
        return array_pop($exercises);
10554
    }
10555
10556
    /**
10557
     * Calculate the total points achieved for the current user in this learning path