original_string: protected function self_allocation($authors=array(), $reviewers=array(), $assessments=array()) {
          if (!isset($authors[0]) || !isset($reviewers[0])) {
              // no authors or no reviewers
              return array();
          }
          $alreadyallocated = array();
          foreach ($assessments as $assessment) {
              if ($assessment->authorid == $assessment->reviewerid) {
                  $alreadyallocated[$assessment->authorid] = 1;
              }
          }
          $add = array(); // list of new allocations to be created
          foreach ($authors[0] as $authorid => $author) {
              // for all authors in all groups
              if (isset($reviewers[0][$authorid])) {
                  // if the author can be reviewer
                  if (!isset($alreadyallocated[$authorid])) {
                      // and the allocation does not exist yet, then
                      $add[] = array($authorid => $authorid);
                  }
              }
          }
          return $add;
      }
code: protected function self_allocation($authors=array(), $reviewers=array(), $assessments=array()) {
          if (!isset($authors[0]) || !isset($reviewers[0])) {
              // no authors or no reviewers
              return array();
          }
          $alreadyallocated = array();
          foreach ($assessments as $assessment) {
              if ($assessment->authorid == $assessment->reviewerid) {
                  $alreadyallocated[$assessment->authorid] = 1;
              }
          }
          $add = array(); // list of new allocations to be created
          foreach ($authors[0] as $authorid => $author) {
              // for all authors in all groups
              if (isset($reviewers[0][$authorid])) {
                  // if the author can be reviewer
                  if (!isset($alreadyallocated[$authorid])) {
                      // and the allocation does not exist yet, then
                      $add[] = array($authorid => $authorid);
                  }
              }
          }
          return $add;
      }
code_tokens: protected function self_allocation ( $ authors = array ( ) , $ reviewers = array ( ) , $ assessments = array ( ) ) { if ( ! isset ( $ authors [ 0 ] ) || ! isset ( $ reviewers [ 0 ] ) ) { // no authors or no reviewers return array ( ) ; } $ alreadyallocated = array ( ) ; foreach ( $ assessments as $ assessment ) { if ( $ assessment -> authorid == $ assessment -> reviewerid ) { $ alreadyallocated [ $ assessment -> authorid ] = 1 ; } } $ add = array ( ) ; // list of new allocations to be created foreach ( $ authors [ 0 ] as $ authorid => $ author ) { // for all authors in all groups if ( isset ( $ reviewers [ 0 ] [ $ authorid ] ) ) { // if the author can be reviewer if ( ! isset ( $ alreadyallocated [ $ authorid ] ) ) { // and the allocation does not exist yet, then $ add [ ] = array ( $ authorid => $ authorid ) ; } } } return $ add ; }
docstring: Allocates submissions to their authors for review
  
  If the submission has already been allocated, it is skipped. If the author is not found among
  reviewers, the submission is not assigned.
  
  @param array $authors grouped of {@see workshop::get_potential_authors()}
  @param array $reviewers grouped by {@see workshop::get_potential_reviewers()}
  @param array $assessments as returned by {@see workshop::get_all_assessments()}
  @return array of new allocations to be created, array of array(reviewerid => authorid)
docstring_tokens: Allocates submissions to their authors for review