original_string: public static function get_attempt_data($attemptid, $page, $preflightdata = array()) {
  
          $warnings = array();
  
          $params = array(
              'attemptid' => $attemptid,
              'page' => $page,
              'preflightdata' => $preflightdata,
          );
          $params = self::validate_parameters(self::get_attempt_data_parameters(), $params);
  
          list($attemptobj, $messages) = self::validate_attempt($params);
  
          if ($attemptobj->is_last_page($params['page'])) {
              $nextpage = -1;
          } else {
              $nextpage = $params['page'] + 1;
          }
  
          $result = array();
          $result['attempt'] = $attemptobj->get_attempt();
          $result['messages'] = $messages;
          $result['nextpage'] = $nextpage;
          $result['warnings'] = $warnings;
          $result['questions'] = self::get_attempt_questions_data($attemptobj, false, $params['page']);
  
          return $result;
      }
code: public static function get_attempt_data($attemptid, $page, $preflightdata = array()) {
  
          $warnings = array();
  
          $params = array(
              'attemptid' => $attemptid,
              'page' => $page,
              'preflightdata' => $preflightdata,
          );
          $params = self::validate_parameters(self::get_attempt_data_parameters(), $params);
  
          list($attemptobj, $messages) = self::validate_attempt($params);
  
          if ($attemptobj->is_last_page($params['page'])) {
              $nextpage = -1;
          } else {
              $nextpage = $params['page'] + 1;
          }
  
          $result = array();
          $result['attempt'] = $attemptobj->get_attempt();
          $result['messages'] = $messages;
          $result['nextpage'] = $nextpage;
          $result['warnings'] = $warnings;
          $result['questions'] = self::get_attempt_questions_data($attemptobj, false, $params['page']);
  
          return $result;
      }
code_tokens: public static function get_attempt_data ( $ attemptid , $ page , $ preflightdata = array ( ) ) { $ warnings = array ( ) ; $ params = array ( 'attemptid' => $ attemptid , 'page' => $ page , 'preflightdata' => $ preflightdata , ) ; $ params = self :: validate_parameters ( self :: get_attempt_data_parameters ( ) , $ params ) ; list ( $ attemptobj , $ messages ) = self :: validate_attempt ( $ params ) ; if ( $ attemptobj -> is_last_page ( $ params [ 'page' ] ) ) { $ nextpage = - 1 ; } else { $ nextpage = $ params [ 'page' ] + 1 ; } $ result = array ( ) ; $ result [ 'attempt' ] = $ attemptobj -> get_attempt ( ) ; $ result [ 'messages' ] = $ messages ; $ result [ 'nextpage' ] = $ nextpage ; $ result [ 'warnings' ] = $ warnings ; $ result [ 'questions' ] = self :: get_attempt_questions_data ( $ attemptobj , false , $ params [ 'page' ] ) ; return $ result ; }
docstring: Returns information for the given attempt page for a quiz attempt in progress.
  
  @param int $attemptid attempt id
  @param int $page page number
  @param array $preflightdata preflight required data (like passwords)
  @return array of warnings and the attempt data, next page, message and questions
  @since Moodle 3.1
  @throws moodle_quiz_exceptions
docstring_tokens: Returns information for the given attempt page for a quiz attempt in progress .