Code Duplication    Length = 14-16 lines in 2 locations

main/newscorm/learnpath.class.php 2 locations

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