original_string: protected function validate_question_data($question) {
          $this->validate_text($question->questiontext); // Yes, really no ['text'].
  
          if (isset($question->generalfeedback['text'])) {
              $this->validate_text($question->generalfeedback['text']);
          } else if (isset($question->generalfeedback)) {
              $this->validate_text($question->generalfeedback); // Because question import is weird.
          }
  
          foreach ($question->answer as $key => $answer) {
              $this->validate_answer($answer);
              $this->validate_text($question->feedback[$key]['text']);
          }
      }
code: protected function validate_question_data($question) {
          $this->validate_text($question->questiontext); // Yes, really no ['text'].
  
          if (isset($question->generalfeedback['text'])) {
              $this->validate_text($question->generalfeedback['text']);
          } else if (isset($question->generalfeedback)) {
              $this->validate_text($question->generalfeedback); // Because question import is weird.
          }
  
          foreach ($question->answer as $key => $answer) {
              $this->validate_answer($answer);
              $this->validate_text($question->feedback[$key]['text']);
          }
      }
code_tokens: protected function validate_question_data ( $ question ) { $ this -> validate_text ( $ question -> questiontext ) ; // Yes, really no ['text']. if ( isset ( $ question -> generalfeedback [ 'text' ] ) ) { $ this -> validate_text ( $ question -> generalfeedback [ 'text' ] ) ; } else if ( isset ( $ question -> generalfeedback ) ) { $ this -> validate_text ( $ question -> generalfeedback ) ; // Because question import is weird. } foreach ( $ question -> answer as $ key => $ answer ) { $ this -> validate_answer ( $ answer ) ; $ this -> validate_text ( $ question -> feedback [ $ key ] [ 'text' ] ) ; } }
docstring: Validate data before save.
  @param stdClass $question data from the form / import file.
docstring_tokens: Validate data before save .