original_string: public function extend_assignable_roles($context, $defaultrole) {
          global $DB;
  
          $roles = get_assignable_roles($context, ROLENAME_BOTH);
          if (!isset($roles[$defaultrole])) {
              if ($role = $DB->get_record('role', array('id' => $defaultrole))) {
                  $roles[$defaultrole] = role_get_name($role, $context, ROLENAME_BOTH);
              }
          }
          return $roles;
      }
code: public function extend_assignable_roles($context, $defaultrole) {
          global $DB;
  
          $roles = get_assignable_roles($context, ROLENAME_BOTH);
          if (!isset($roles[$defaultrole])) {
              if ($role = $DB->get_record('role', array('id' => $defaultrole))) {
                  $roles[$defaultrole] = role_get_name($role, $context, ROLENAME_BOTH);
              }
          }
          return $roles;
      }
code_tokens: public function extend_assignable_roles ( $ context , $ defaultrole ) { global $ DB ; $ roles = get_assignable_roles ( $ context , ROLENAME_BOTH ) ; if ( ! isset ( $ roles [ $ defaultrole ] ) ) { if ( $ role = $ DB -> get_record ( 'role' , array ( 'id' => $ defaultrole ) ) ) { $ roles [ $ defaultrole ] = role_get_name ( $ role , $ context , ROLENAME_BOTH ) ; } } return $ roles ; }
docstring: Gets a list of roles that this user can assign for the course as the default for self-enrolment.
  
  @param context $context the context.
  @param integer $defaultrole the id of the role that is set as the default for self-enrolment
  @return array index is the role id, value is the role name
docstring_tokens: Gets a list of roles that this user can assign for the course as the default for self - enrolment .