Code Duplication    Length = 14-16 lines in 2 locations

main/lp/learnpath.class.php 2 locations

@@ 11303-11318 (lines=16) @@
11300
     * Get the items of exercise type
11301
     * @return array The items. Otherwise return false
11302
     */
11303
    public function getExercisesItems()
11304
    {
11305
        $exercises = [];
11306
        foreach ($this->items as $item) {
11307
            if ($item->type != 'quiz') {
11308
                continue;
11309
            }
11310
            $exercises[] = $item;
11311
        }
11312
11313
        array_pop($exercises);
11314
11315
        return $exercises;
11316
    }
11317
11318
    /**
11319
     * Get the item of exercise type (evaluation type)
11320
     * @return array The final evaluation. Otherwise return false
11321
     */
@@ 11322-11335 (lines=14) @@
11319
     * Get the item of exercise type (evaluation type)
11320
     * @return array The final evaluation. Otherwise return false
11321
     */
11322
    public function getFinalEvaluationItem()
11323
    {
11324
        $exercises = [];
11325
        foreach ($this->items as $item) {
11326
            if ($item->type != 'quiz') {
11327
                continue;
11328
            }
11329
11330
            $exercises[] = $item;
11331
        }
11332
11333
        return array_pop($exercises);
11334
    }
11335
11336
    /**
11337
     * Calculate the total points achieved for the current user in this learning path
11338
     * @param int $sessionId Optional. The session Id