Code Duplication    Length = 7-7 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 5746-5752 (lines=7) @@
5743
        }
5744
5745
        // Deleted exercise.
5746
        if ($this->active == -1) {
5747
            return array(
5748
                'value' => false,
5749
                'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false),
5750
                'rawMessage' => get_lang('ExerciseNotFound')
5751
            );
5752
        }
5753
5754
        // Checking visibility in the item_property table.
5755
        $visibility = api_get_item_visibility(
@@ 5769-5775 (lines=7) @@
5766
        // 2. If the exercise is not active.
5767
        if (empty($lpId)) {
5768
            // 2.1 LP is OFF
5769
            if ($this->active == 0) {
5770
                return array(
5771
                    'value' => false,
5772
                    'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false),
5773
                    'rawMessage' => get_lang('ExerciseNotFound')
5774
                );
5775
            }
5776
        } else {
5777
            // 2.1 LP is loaded
5778
            if ($this->active == 0 && !learnpath::is_lp_visible_for_student($lpId, api_get_user_id())) {