original_string: protected function index_submissions_by_authors($submissions) {
          $byauthor = array();
          if (is_array($submissions)) {
              foreach ($submissions as $submissionid => $submission) {
                  if (isset($byauthor[$submission->authorid])) {
                      throw new moodle_exception('moresubmissionsbyauthor', 'workshop');
                  }
                  $byauthor[$submission->authorid] = $submission;
              }
          }
          return $byauthor;
      }
code: protected function index_submissions_by_authors($submissions) {
          $byauthor = array();
          if (is_array($submissions)) {
              foreach ($submissions as $submissionid => $submission) {
                  if (isset($byauthor[$submission->authorid])) {
                      throw new moodle_exception('moresubmissionsbyauthor', 'workshop');
                  }
                  $byauthor[$submission->authorid] = $submission;
              }
          }
          return $byauthor;
      }
code_tokens: protected function index_submissions_by_authors ( $ submissions ) { $ byauthor = array ( ) ; if ( is_array ( $ submissions ) ) { foreach ( $ submissions as $ submissionid => $ submission ) { if ( isset ( $ byauthor [ $ submission -> authorid ] ) ) { throw new moodle_exception ( 'moresubmissionsbyauthor' , 'workshop' ) ; } $ byauthor [ $ submission -> authorid ] = $ submission ; } } return $ byauthor ; }
docstring: Flips the structure of submission so it is indexed by authorid attribute
  
  It is the caller's responsibility to make sure the submissions are not teacher
  examples so no user is the author of more submissions.
  
  @param string $submissions array indexed by submission id
  @return array indexed by author id
docstring_tokens: Flips the structure of submission so it is indexed by authorid attribute