Code Duplication    Length = 14-16 lines in 2 locations

main/newscorm/learnpath.class.php 2 locations

@@ 10574-10589 (lines=16) @@
10571
     * Get the items of exercise type
10572
     * @return array The items. Otherwise return false
10573
     */
10574
    public function getExercisesItems()
10575
    {
10576
        $exercises = [];
10577
10578
        foreach ($this->items as $item) {
10579
            if ($item->type != 'quiz') {
10580
                continue;
10581
            }
10582
10583
            $exercises[] = $item;
10584
        }
10585
10586
        array_pop($exercises);
10587
10588
        return $exercises;
10589
    }
10590
10591
    /**
10592
     * Get the item of exercise type (evaluation type)
@@ 10595-10608 (lines=14) @@
10592
     * Get the item of exercise type (evaluation type)
10593
     * @return array The final evaluation. Otherwise return false
10594
     */
10595
    public function getFinalEvaluationItem()
10596
    {
10597
        $exercises = [];
10598
10599
        foreach ($this->items as $item) {
10600
            if ($item->type != 'quiz') {
10601
                continue;
10602
            }
10603
10604
            $exercises[] = $item;
10605
        }
10606
10607
        return array_pop($exercises);
10608
    }
10609
10610
    /**
10611
     * Calculate the total points achieved for the current user in this learning path