original_string: public static function get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber) {
          $document = self::get_combined_document_for_attempt($assignment, $userid, $attemptnumber);
  
          if ($document->get_status() === combined_document::STATUS_COMPLETE) {
              // The combined document is already ready.
              return $document;
          } else {
              // Attempt to combined the files in the document.
              $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
              $document->combine_files($assignment->get_context()->id, $grade->id);
              return $document;
          }
      }
code: public static function get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber) {
          $document = self::get_combined_document_for_attempt($assignment, $userid, $attemptnumber);
  
          if ($document->get_status() === combined_document::STATUS_COMPLETE) {
              // The combined document is already ready.
              return $document;
          } else {
              // Attempt to combined the files in the document.
              $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
              $document->combine_files($assignment->get_context()->id, $grade->id);
              return $document;
          }
      }
code_tokens: public static function get_combined_pdf_for_attempt ( $ assignment , $ userid , $ attemptnumber ) { $ document = self :: get_combined_document_for_attempt ( $ assignment , $ userid , $ attemptnumber ) ; if ( $ document -> get_status ( ) === combined_document :: STATUS_COMPLETE ) { // The combined document is already ready. return $ document ; } else { // Attempt to combined the files in the document. $ grade = $ assignment -> get_user_grade ( $ userid , true , $ attemptnumber ) ; $ document -> combine_files ( $ assignment -> get_context ( ) -> id , $ grade -> id ) ; return $ document ; } }
docstring: This function return the combined pdf for all valid submission files.
  
  @param int|\assign $assignment
  @param int $userid
  @param int $attemptnumber (-1 means latest attempt)
  @return combined_document
docstring_tokens: This function return the combined pdf for all valid submission files .