original_string: private static function generate_warning($assignmentid, $warningcode, $detail) {
          $warningmessages = array(
              'couldnotlock'=>'Could not lock the submission for this user.',
              'couldnotunlock'=>'Could not unlock the submission for this user.',
              'couldnotsubmitforgrading'=>'Could not submit assignment for grading.',
              'couldnotrevealidentities'=>'Could not reveal identities.',
              'couldnotgrantextensions'=>'Could not grant submission date extensions.',
              'couldnotrevert'=>'Could not revert submission to draft.',
              'invalidparameters'=>'Invalid parameters.',
              'couldnotsavesubmission'=>'Could not save submission.',
              'couldnotsavegrade'=>'Could not save grade.'
          );
  
          $message = $warningmessages[$warningcode];
          if (empty($message)) {
              $message = 'Unknown warning type.';
          }
  
          return array('item' => s($detail),
                       'itemid'=>$assignmentid,
                       'warningcode'=>$warningcode,
                       'message'=>$message);
      }
code: private static function generate_warning($assignmentid, $warningcode, $detail) {
          $warningmessages = array(
              'couldnotlock'=>'Could not lock the submission for this user.',
              'couldnotunlock'=>'Could not unlock the submission for this user.',
              'couldnotsubmitforgrading'=>'Could not submit assignment for grading.',
              'couldnotrevealidentities'=>'Could not reveal identities.',
              'couldnotgrantextensions'=>'Could not grant submission date extensions.',
              'couldnotrevert'=>'Could not revert submission to draft.',
              'invalidparameters'=>'Invalid parameters.',
              'couldnotsavesubmission'=>'Could not save submission.',
              'couldnotsavegrade'=>'Could not save grade.'
          );
  
          $message = $warningmessages[$warningcode];
          if (empty($message)) {
              $message = 'Unknown warning type.';
          }
  
          return array('item' => s($detail),
                       'itemid'=>$assignmentid,
                       'warningcode'=>$warningcode,
                       'message'=>$message);
      }
code_tokens: private static function generate_warning ( $ assignmentid , $ warningcode , $ detail ) { $ warningmessages = array ( 'couldnotlock' => 'Could not lock the submission for this user.' , 'couldnotunlock' => 'Could not unlock the submission for this user.' , 'couldnotsubmitforgrading' => 'Could not submit assignment for grading.' , 'couldnotrevealidentities' => 'Could not reveal identities.' , 'couldnotgrantextensions' => 'Could not grant submission date extensions.' , 'couldnotrevert' => 'Could not revert submission to draft.' , 'invalidparameters' => 'Invalid parameters.' , 'couldnotsavesubmission' => 'Could not save submission.' , 'couldnotsavegrade' => 'Could not save grade.' ) ; $ message = $ warningmessages [ $ warningcode ] ; if ( empty ( $ message ) ) { $ message = 'Unknown warning type.' ; } return array ( 'item' => s ( $ detail ) , 'itemid' => $ assignmentid , 'warningcode' => $ warningcode , 'message' => $ message ) ; }
docstring: Generate a warning in a standard structure for a known failure.
  
  @param int $assignmentid - The assignment
  @param string $warningcode - The key for the warning message
  @param string $detail - A description of the error
  @return array - Warning structure containing item, itemid, warningcode, message
docstring_tokens: Generate a warning in a standard structure for a known failure .