original_string: protected function get_allow_roles_list($type, $roleid = null) {
          global $DB;
  
          if ($type !== 'assign' and $type !== 'switch' and $type !== 'override' and $type !== 'view') {
              debugging('Invalid role allowed type specified', DEBUG_DEVELOPER);
              return array();
          }
  
          if ($roleid === null) {
              $roleid = $this->roleid;
          }
  
          if (empty($roleid)) {
              return array();
          }
  
          $sql = "SELECT r.*
                    FROM {role} r
                    JOIN {role_allow_{$type}} a ON a.allow{$type} = r.id
                   WHERE a.roleid = :roleid
                ORDER BY r.sortorder ASC";
          return $DB->get_records_sql($sql, array('roleid'=>$roleid));
      }
code: protected function get_allow_roles_list($type, $roleid = null) {
          global $DB;
  
          if ($type !== 'assign' and $type !== 'switch' and $type !== 'override' and $type !== 'view') {
              debugging('Invalid role allowed type specified', DEBUG_DEVELOPER);
              return array();
          }
  
          if ($roleid === null) {
              $roleid = $this->roleid;
          }
  
          if (empty($roleid)) {
              return array();
          }
  
          $sql = "SELECT r.*
                    FROM {role} r
                    JOIN {role_allow_{$type}} a ON a.allow{$type} = r.id
                   WHERE a.roleid = :roleid
                ORDER BY r.sortorder ASC";
          return $DB->get_records_sql($sql, array('roleid'=>$roleid));
      }
code_tokens: protected function get_allow_roles_list ( $ type , $ roleid = null ) { global $ DB ; if ( $ type !== 'assign' and $ type !== 'switch' and $ type !== 'override' and $ type !== 'view' ) { debugging ( 'Invalid role allowed type specified' , DEBUG_DEVELOPER ) ; return array ( ) ; } if ( $ roleid === null ) { $ roleid = $ this -> roleid ; } if ( empty ( $ roleid ) ) { return array ( ) ; } $ sql = "SELECT r.*
                    FROM {role} r
                    JOIN {role_allow_{$type}} a ON a.allow{$type} = r.id
                   WHERE a.roleid = :roleid
                ORDER BY r.sortorder ASC" ; return $ DB -> get_records_sql ( $ sql , array ( 'roleid' => $ roleid ) ) ; }
docstring: Returns an array of roles of the allowed type.
  
  @param string $type Must be one of: assign, switch, or override.
  @param int $roleid (null means current role)
  @return array
docstring_tokens: Returns an array of roles of the allowed type .