original_string: public static function get_instance_info($instanceid) {
          global $DB, $CFG;
  
          require_once($CFG->libdir . '/enrollib.php');
  
          $params = self::validate_parameters(self::get_instance_info_parameters(), array('instanceid' => $instanceid));
  
          // Retrieve self enrolment plugin.
          $enrolplugin = enrol_get_plugin('self');
          if (empty($enrolplugin)) {
              throw new moodle_exception('invaliddata', 'error');
          }
  
          self::validate_context(context_system::instance());
  
          $enrolinstance = $DB->get_record('enrol', array('id' => $params['instanceid']), '*', MUST_EXIST);
          $course = $DB->get_record('course', array('id' => $enrolinstance->courseid), '*', MUST_EXIST);
          if (!core_course_category::can_view_course_info($course) && !can_access_course($course)) {
              throw new moodle_exception('coursehidden');
          }
  
          $instanceinfo = (array) $enrolplugin->get_enrol_info($enrolinstance);
          if (isset($instanceinfo['requiredparam']->enrolpassword)) {
              $instanceinfo['enrolpassword'] = $instanceinfo['requiredparam']->enrolpassword;
          }
          unset($instanceinfo->requiredparam);
  
          return $instanceinfo;
      }
code: public static function get_instance_info($instanceid) {
          global $DB, $CFG;
  
          require_once($CFG->libdir . '/enrollib.php');
  
          $params = self::validate_parameters(self::get_instance_info_parameters(), array('instanceid' => $instanceid));
  
          // Retrieve self enrolment plugin.
          $enrolplugin = enrol_get_plugin('self');
          if (empty($enrolplugin)) {
              throw new moodle_exception('invaliddata', 'error');
          }
  
          self::validate_context(context_system::instance());
  
          $enrolinstance = $DB->get_record('enrol', array('id' => $params['instanceid']), '*', MUST_EXIST);
          $course = $DB->get_record('course', array('id' => $enrolinstance->courseid), '*', MUST_EXIST);
          if (!core_course_category::can_view_course_info($course) && !can_access_course($course)) {
              throw new moodle_exception('coursehidden');
          }
  
          $instanceinfo = (array) $enrolplugin->get_enrol_info($enrolinstance);
          if (isset($instanceinfo['requiredparam']->enrolpassword)) {
              $instanceinfo['enrolpassword'] = $instanceinfo['requiredparam']->enrolpassword;
          }
          unset($instanceinfo->requiredparam);
  
          return $instanceinfo;
      }
code_tokens: public static function get_instance_info ( $ instanceid ) { global $ DB , $ CFG ; require_once ( $ CFG -> libdir . '/enrollib.php' ) ; $ params = self :: validate_parameters ( self :: get_instance_info_parameters ( ) , array ( 'instanceid' => $ instanceid ) ) ; // Retrieve self enrolment plugin. $ enrolplugin = enrol_get_plugin ( 'self' ) ; if ( empty ( $ enrolplugin ) ) { throw new moodle_exception ( 'invaliddata' , 'error' ) ; } self :: validate_context ( context_system :: instance ( ) ) ; $ enrolinstance = $ DB -> get_record ( 'enrol' , array ( 'id' => $ params [ 'instanceid' ] ) , '*' , MUST_EXIST ) ; $ course = $ DB -> get_record ( 'course' , array ( 'id' => $ enrolinstance -> courseid ) , '*' , MUST_EXIST ) ; if ( ! core_course_category :: can_view_course_info ( $ course ) && ! can_access_course ( $ course ) ) { throw new moodle_exception ( 'coursehidden' ) ; } $ instanceinfo = ( array ) $ enrolplugin -> get_enrol_info ( $ enrolinstance ) ; if ( isset ( $ instanceinfo [ 'requiredparam' ] -> enrolpassword ) ) { $ instanceinfo [ 'enrolpassword' ] = $ instanceinfo [ 'requiredparam' ] -> enrolpassword ; } unset ( $ instanceinfo -> requiredparam ) ; return $ instanceinfo ; }
docstring: Return self-enrolment instance information.
  
  @param int $instanceid instance id of self enrolment plugin.
  @return array instance information.
  @throws moodle_exception
docstring_tokens: Return self - enrolment instance information .