original_string: protected function get_enroller($courseid) {
          if ($this->lasternollercourseid == $courseid and $this->lasternoller) {
              return $this->lasternoller;
          }
  
          $context = context_course::instance($courseid);
  
          $users = get_enrolled_users($context, 'enrol/flatfile:manage');
          if (!$users) {
              $users = get_enrolled_users($context, 'moodle/role:assign');
          }
  
          if ($users) {
              $users = sort_by_roleassignment_authority($users, $context);
              $this->lasternoller = reset($users);
              unset($users);
          } else {
              $this->lasternoller = get_admin();
          }
  
          $this->lasternollercourseid == $courseid;
  
          return $this->lasternoller;
      }
code: protected function get_enroller($courseid) {
          if ($this->lasternollercourseid == $courseid and $this->lasternoller) {
              return $this->lasternoller;
          }
  
          $context = context_course::instance($courseid);
  
          $users = get_enrolled_users($context, 'enrol/flatfile:manage');
          if (!$users) {
              $users = get_enrolled_users($context, 'moodle/role:assign');
          }
  
          if ($users) {
              $users = sort_by_roleassignment_authority($users, $context);
              $this->lasternoller = reset($users);
              unset($users);
          } else {
              $this->lasternoller = get_admin();
          }
  
          $this->lasternollercourseid == $courseid;
  
          return $this->lasternoller;
      }
code_tokens: protected function get_enroller ( $ courseid ) { if ( $ this -> lasternollercourseid == $ courseid and $ this -> lasternoller ) { return $ this -> lasternoller ; } $ context = context_course :: instance ( $ courseid ) ; $ users = get_enrolled_users ( $ context , 'enrol/flatfile:manage' ) ; if ( ! $ users ) { $ users = get_enrolled_users ( $ context , 'moodle/role:assign' ) ; } if ( $ users ) { $ users = sort_by_roleassignment_authority ( $ users , $ context ) ; $ this -> lasternoller = reset ( $ users ) ; unset ( $ users ) ; } else { $ this -> lasternoller = get_admin ( ) ; } $ this -> lasternollercourseid == $ courseid ; return $ this -> lasternoller ; }
docstring: Returns the user who is responsible for flatfile enrolments in given curse.
  
  Usually it is the first editing teacher - the person with "highest authority"
  as defined by sort_by_roleassignment_authority() having 'enrol/flatfile:manage'
  or 'moodle/role:assign' capability.
  
  @param int $courseid enrolment instance id
  @return stdClass user record
docstring_tokens: Returns the user who is responsible for flatfile enrolments in given curse .