Code Duplication    Length = 7-7 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 5751-5757 (lines=7) @@
5748
        }
5749
5750
        // Deleted exercise.
5751
        if ($this->active == -1) {
5752
            return array(
5753
                'value' => false,
5754
                'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false),
5755
                'rawMessage' => get_lang('ExerciseNotFound')
5756
            );
5757
        }
5758
5759
        // Checking visibility in the item_property table.
5760
        $visibility = api_get_item_visibility(
@@ 5774-5780 (lines=7) @@
5771
        // 2. If the exercise is not active.
5772
        if (empty($lpId)) {
5773
            // 2.1 LP is OFF
5774
            if ($this->active == 0) {
5775
                return array(
5776
                    'value' => false,
5777
                    'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false),
5778
                    'rawMessage' => get_lang('ExerciseNotFound')
5779
                );
5780
            }
5781
        } else {
5782
            // 2.1 LP is loaded
5783
            if ($this->active == 0 && !learnpath::is_lp_visible_for_student($lpId, api_get_user_id())) {