Code Duplication    Length = 14-16 lines in 2 locations

main/newscorm/learnpath.class.php 2 locations

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