Code Duplication    Length = 14-16 lines in 2 locations

main/lp/learnpath.class.php 2 locations

@@ 11249-11264 (lines=16) @@
11246
     * Get the items of exercise type
11247
     * @return array The items. Otherwise return false
11248
     */
11249
    public function getExercisesItems()
11250
    {
11251
        $exercises = [];
11252
        foreach ($this->items as $item) {
11253
            if ($item->type != 'quiz') {
11254
                continue;
11255
            }
11256
            $exercises[] = $item;
11257
        }
11258
11259
        array_pop($exercises);
11260
11261
        return $exercises;
11262
    }
11263
11264
    /**
11265
     * Get the item of exercise type (evaluation type)
11266
     * @return array The final evaluation. Otherwise return false
11267
     */
@@ 11268-11281 (lines=14) @@
11265
     * Get the item of exercise type (evaluation type)
11266
     * @return array The final evaluation. Otherwise return false
11267
     */
11268
    public function getFinalEvaluationItem()
11269
    {
11270
        $exercises = [];
11271
        foreach ($this->items as $item) {
11272
            if ($item->type != 'quiz') {
11273
                continue;
11274
            }
11275
11276
            $exercises[] = $item;
11277
        }
11278
11279
        return array_pop($exercises);
11280
    }
11281
11282
    /**
11283
     * Calculate the total points achieved for the current user in this learning path
11284
     * @param int $sessionId Optional. The session Id