original_string: public static function get_course_enrolment_methods($courseid) {
          global $DB;
  
          $params = self::validate_parameters(self::get_course_enrolment_methods_parameters(), array('courseid' => $courseid));
          self::validate_context(context_system::instance());
  
          $course = $DB->get_record('course', array('id' => $params['courseid']), '*', MUST_EXIST);
          if (!core_course_category::can_view_course_info($course) && !can_access_course($course)) {
              throw new moodle_exception('coursehidden');
          }
  
          $result = array();
          $enrolinstances = enrol_get_instances($params['courseid'], true);
          foreach ($enrolinstances as $enrolinstance) {
              if ($enrolplugin = enrol_get_plugin($enrolinstance->enrol)) {
                  if ($instanceinfo = $enrolplugin->get_enrol_info($enrolinstance)) {
                      $result[] = (array) $instanceinfo;
                  }
              }
          }
          return $result;
      }
code: public static function get_course_enrolment_methods($courseid) {
          global $DB;
  
          $params = self::validate_parameters(self::get_course_enrolment_methods_parameters(), array('courseid' => $courseid));
          self::validate_context(context_system::instance());
  
          $course = $DB->get_record('course', array('id' => $params['courseid']), '*', MUST_EXIST);
          if (!core_course_category::can_view_course_info($course) && !can_access_course($course)) {
              throw new moodle_exception('coursehidden');
          }
  
          $result = array();
          $enrolinstances = enrol_get_instances($params['courseid'], true);
          foreach ($enrolinstances as $enrolinstance) {
              if ($enrolplugin = enrol_get_plugin($enrolinstance->enrol)) {
                  if ($instanceinfo = $enrolplugin->get_enrol_info($enrolinstance)) {
                      $result[] = (array) $instanceinfo;
                  }
              }
          }
          return $result;
      }
code_tokens: public static function get_course_enrolment_methods ( $ courseid ) { global $ DB ; $ params = self :: validate_parameters ( self :: get_course_enrolment_methods_parameters ( ) , array ( 'courseid' => $ courseid ) ) ; self :: validate_context ( context_system :: instance ( ) ) ; $ course = $ DB -> get_record ( 'course' , array ( 'id' => $ params [ 'courseid' ] ) , '*' , MUST_EXIST ) ; if ( ! core_course_category :: can_view_course_info ( $ course ) && ! can_access_course ( $ course ) ) { throw new moodle_exception ( 'coursehidden' ) ; } $ result = array ( ) ; $ enrolinstances = enrol_get_instances ( $ params [ 'courseid' ] , true ) ; foreach ( $ enrolinstances as $ enrolinstance ) { if ( $ enrolplugin = enrol_get_plugin ( $ enrolinstance -> enrol ) ) { if ( $ instanceinfo = $ enrolplugin -> get_enrol_info ( $ enrolinstance ) ) { $ result [ ] = ( array ) $ instanceinfo ; } } } return $ result ; }
docstring: Get list of active course enrolment methods for current user.
  
  @param int $courseid
  @return array of course enrolment methods
  @throws moodle_exception
docstring_tokens: Get list of active course enrolment methods for current user .