original_string: public function update_form_data(stdClass $data) : stdClass {
          $answercount = count($this->get_answers());
          // Check for other answer entry.
          $lastanswer = $data->{'answer_editor[' . ($answercount - 1) . ']'};
          if (strpos($lastanswer, LESSON_OTHER_ANSWERS) !== false) {
              $data->{'answer_editor[' . ($this->lesson->maxanswers + 1) . ']'} =
                      $data->{'answer_editor[' . ($answercount - 1) . ']'};
              $data->{'response_editor[' . ($this->lesson->maxanswers + 1) . ']'} =
                      $data->{'response_editor[' . ($answercount - 1) . ']'};
              $data->{'jumpto[' . ($this->lesson->maxanswers + 1) . ']'} = $data->{'jumpto[' . ($answercount - 1) . ']'};
              $data->{'score[' . ($this->lesson->maxanswers + 1) . ']'} = $data->{'score[' . ($answercount - 1) . ']'};
              $data->enableotheranswers = true;
              // Unset the old values.
              unset($data->{'answer_editor[' . ($answercount - 1) . ']'});
              unset($data->{'response_editor[' . ($answercount - 1) . ']'});
              unset($data->{'jumpto[' . ($answercount - 1) . ']'});
              unset($data->{'score[' . ($answercount - 1) . ']'});
          }
          return $data;
      }
code: public function update_form_data(stdClass $data) : stdClass {
          $answercount = count($this->get_answers());
          // Check for other answer entry.
          $lastanswer = $data->{'answer_editor[' . ($answercount - 1) . ']'};
          if (strpos($lastanswer, LESSON_OTHER_ANSWERS) !== false) {
              $data->{'answer_editor[' . ($this->lesson->maxanswers + 1) . ']'} =
                      $data->{'answer_editor[' . ($answercount - 1) . ']'};
              $data->{'response_editor[' . ($this->lesson->maxanswers + 1) . ']'} =
                      $data->{'response_editor[' . ($answercount - 1) . ']'};
              $data->{'jumpto[' . ($this->lesson->maxanswers + 1) . ']'} = $data->{'jumpto[' . ($answercount - 1) . ']'};
              $data->{'score[' . ($this->lesson->maxanswers + 1) . ']'} = $data->{'score[' . ($answercount - 1) . ']'};
              $data->enableotheranswers = true;
              // Unset the old values.
              unset($data->{'answer_editor[' . ($answercount - 1) . ']'});
              unset($data->{'response_editor[' . ($answercount - 1) . ']'});
              unset($data->{'jumpto[' . ($answercount - 1) . ']'});
              unset($data->{'score[' . ($answercount - 1) . ']'});
          }
          return $data;
      }
code_tokens: public function update_form_data ( stdClass $ data ) : stdClass { $ answercount = count ( $ this -> get_answers ( ) ) ; // Check for other answer entry. $ lastanswer = $ data -> { 'answer_editor[' . ( $ answercount - 1 ) . ']' } ; if ( strpos ( $ lastanswer , LESSON_OTHER_ANSWERS ) !== false ) { $ data -> { 'answer_editor[' . ( $ this -> lesson -> maxanswers + 1 ) . ']' } = $ data -> { 'answer_editor[' . ( $ answercount - 1 ) . ']' } ; $ data -> { 'response_editor[' . ( $ this -> lesson -> maxanswers + 1 ) . ']' } = $ data -> { 'response_editor[' . ( $ answercount - 1 ) . ']' } ; $ data -> { 'jumpto[' . ( $ this -> lesson -> maxanswers + 1 ) . ']' } = $ data -> { 'jumpto[' . ( $ answercount - 1 ) . ']' } ; $ data -> { 'score[' . ( $ this -> lesson -> maxanswers + 1 ) . ']' } = $ data -> { 'score[' . ( $ answercount - 1 ) . ']' } ; $ data -> enableotheranswers = true ; // Unset the old values. unset ( $ data -> { 'answer_editor[' . ( $ answercount - 1 ) . ']' } ) ; unset ( $ data -> { 'response_editor[' . ( $ answercount - 1 ) . ']' } ) ; unset ( $ data -> { 'jumpto[' . ( $ answercount - 1 ) . ']' } ) ; unset ( $ data -> { 'score[' . ( $ answercount - 1 ) . ']' } ) ; } return $ data ; }
docstring: Make updates to the form data if required. In this case to put the all other answer data into the write section of the form.
  
  @param stdClass $data The form data to update.
  @return stdClass The updated fom data.
docstring_tokens: Make updates to the form data if required . In this case to put the all other answer data into the write section of the form .