Code Duplication    Length = 14-16 lines in 2 locations

main/newscorm/learnpath.class.php 2 locations

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