original_string: protected function get_role_map(progress_trace $trace) {
          global $DB;
  
          // Get all roles.
          $rolemap = array();
          $roles = $DB->get_records('role', null, '', 'id, name, shortname');
          foreach ($roles as $id=>$role) {
              $alias = $this->get_config('map_'.$id, $role->shortname, '');
              $alias = trim(core_text::strtolower($alias));
              if ($alias === '') {
                  // Either not configured yet or somebody wants to skip these intentionally.
                  continue;
              }
              if (isset($rolemap[$alias])) {
                  $trace->output("Duplicate role alias $alias detected!");
              } else {
                  $rolemap[$alias] = $id;
              }
          }
  
          return $rolemap;
      }
code: protected function get_role_map(progress_trace $trace) {
          global $DB;
  
          // Get all roles.
          $rolemap = array();
          $roles = $DB->get_records('role', null, '', 'id, name, shortname');
          foreach ($roles as $id=>$role) {
              $alias = $this->get_config('map_'.$id, $role->shortname, '');
              $alias = trim(core_text::strtolower($alias));
              if ($alias === '') {
                  // Either not configured yet or somebody wants to skip these intentionally.
                  continue;
              }
              if (isset($rolemap[$alias])) {
                  $trace->output("Duplicate role alias $alias detected!");
              } else {
                  $rolemap[$alias] = $id;
              }
          }
  
          return $rolemap;
      }
code_tokens: protected function get_role_map ( progress_trace $ trace ) { global $ DB ; // Get all roles. $ rolemap = array ( ) ; $ roles = $ DB -> get_records ( 'role' , null , '' , 'id, name, shortname' ) ; foreach ( $ roles as $ id => $ role ) { $ alias = $ this -> get_config ( 'map_' . $ id , $ role -> shortname , '' ) ; $ alias = trim ( core_text :: strtolower ( $ alias ) ) ; if ( $ alias === '' ) { // Either not configured yet or somebody wants to skip these intentionally. continue ; } if ( isset ( $ rolemap [ $ alias ] ) ) { $ trace -> output ( "Duplicate role alias $alias detected!" ) ; } else { $ rolemap [ $ alias ] = $ id ; } } return $ rolemap ; }
docstring: Returns a mapping of ims roles to role ids.
  
  @param progress_trace $trace
  @return array imsrolename=>roleid
docstring_tokens: Returns a mapping of ims roles to role ids .