Code Duplication    Length = 8-8 lines in 3 locations

includes/class-sensei-quiz.php 3 locations

@@ 665-672 (lines=8) @@
662
     public function get_user_question_answer( $lesson_id, $question_id, $user_id = 0 ){
663
664
         // parameter validation
665
         if( empty( $lesson_id ) || empty( $question_id )
666
             || ! ( intval( $lesson_id  ) > 0 )
667
             || ! ( intval( $question_id  ) > 0 )
668
             || 'lesson' != get_post_type( $lesson_id )
669
             || 'question' != get_post_type( $question_id )) {
670
671
             return false;
672
         }
673
674
         if( ! ( intval( $user_id ) > 0 )   ){
675
             $user_id = get_current_user_id();
@@ 816-823 (lines=8) @@
813
     public function get_user_question_grade( $lesson_id, $question_id, $user_id = 0 ){
814
815
         // parameter validation
816
         if( empty( $lesson_id ) || empty( $question_id )
817
             || ! ( intval( $lesson_id  ) > 0 )
818
             || ! ( intval( $question_id  ) > 0 )
819
             || 'lesson' != get_post_type( $lesson_id )
820
             || 'question' != get_post_type( $question_id )) {
821
822
             return false;
823
         }
824
825
         $all_user_grades = self::get_user_grades( $lesson_id,$user_id );
826
@@ 988-995 (lines=8) @@
985
         $feedback = false;
986
987
         // parameter validation
988
         if( empty( $lesson_id ) || empty( $question_id )
989
             || ! ( intval( $lesson_id  ) > 0 )
990
             || ! ( intval( $question_id  ) > 0 )
991
             || 'lesson' != get_post_type( $lesson_id )
992
             || 'question' != get_post_type( $question_id )) {
993
994
             return false;
995
         }
996
997
         // get all the feedback for the user on the given lesson
998
         $all_feedback = $this->get_user_answers_feedback( $lesson_id, $user_id );