@param string $class
@param bool   $output

@return string
183381
public static function reflectClass($class, $output = true)
    {
        $data = '';

        $reflectionClass = new \ReflectionClass($class);

        $comment = $reflectionClass->getDocComment();
        if (!empty($comment)) {
            $data .= $comment;
            $data .= "\n";
        }

        $data         .= 'class ' . $reflectionClass->name . '{';
        $firstElement = true;
        foreach ($reflectionClass->getProperties() as $reflectionProperty) {
            if (!$firstElement) {
                $data .= "\n";
            }
            $firstElement = false;

            $data .= self::reflectClassProperty($class, $reflectionProperty->name, false);
        }

        foreach ($reflectionClass->getMethods() as $reflectionMethod) {
            if (!$firstElement) {
                $data .= "\n";
            }
            $firstElement = false;

            $data .= self::reflectClassMethod($class, $reflectionMethod->name, false);
        }
        $data .= "\n";
        $data .= '}';

        if ($output) {
            self::output($data);
        }

        return $data;
    }
569309
public static function loadByPsr0($class)
    {
        $existsBefore = class_exists($class, false);
        $success = parent::loadByPsr0($class);
        if (!$existsBefore && class_exists($class, false)) {
            self::injectStaticDependencies($class);
        }

        return $success;
    }
434958
public function render($output = true)
    {
        //Add header
        $ics = 'BEGIN:VCALENDAR
METHOD:PUBLISH
VERSION:2.0
X-WR-CALNAME:' . $this->calendarName . '
PRODID:-//hacksw/handcal//NONSGML v1.0//EN';

        //Add events
        foreach ($this->events as $event) {
            $ics .= '
BEGIN:VEVENT
UID:' . $event['uid'] . '
DTSTAMP:' . gmdate('Ymd') . 'T' . gmdate('His') . 'Z
DTSTART:' . $event['start'] . '
DTEND:' . $event['end'] . '
SUMMARY:' . str_replace("\n", "\\n", $event['summary']) . '
DESCRIPTION:' . str_replace("\n", "\\n", $event['description']) . '
URL;VALUE=URI:' . $event['url'] . '
END:VEVENT';
        }

        //Add footer
        $ics .= '
END:VCALENDAR';

        if ($output) {
            //Output
            $filename = $this->calendarName;
            //Filename needs quoting if it contains spaces
            if (strpos($filename, ' ') !== false) {
                $filename = '"'.$filename.'"';
            }
            header('Content-type: text/calendar; charset=utf-8');
            header('Content-Disposition: inline; filename=' . $filename . '.ics');
            echo $ics;
        }
        return $ics;
    }
847364
public function display ($file, $output = TRUE)
	{

		// If there is no template directory set then try and use default root/templates directory

		if (!$this->templateDir)
		{
			$this->templateDir	= ABS_ROOT . 'templates' . DIRECTORY_SEPARATOR;
		}

		// Load template

		$template	= $this->loadTemplateFile ($file);

		// Replace variables

		if ($this->replaceVars)
		{
			$rendered	= $this->replaceVars ($template);
		} else {
			$rendered	 = $template;
		}

		// Output

		if ($output)
		{
			echo $rendered;
		}

		// Return template

		return $rendered;

	}
1011537
public function autoload($class)
    {
        $isFallback = $this->isFallbackAutoloader();
        if (false !== strpos($class, self::NS_SEPARATOR)) {
            if ($this->loadClass($class, self::LOAD_NS)) {
                return $class;
            } elseif ($isFallback) {
                return $this->loadClass($class, self::ACT_AS_FALLBACK);
            }
            return false;
        }
        if (false !== strpos($class, self::PREFIX_SEPARATOR)) {
            if ($this->loadClass($class, self::LOAD_PREFIX)) {
                return $class;
            } elseif ($isFallback) {
                return $this->loadClass($class, self::ACT_AS_FALLBACK);
            }
            return false;
        }
        if ($isFallback) {
            return $this->loadClass($class, self::ACT_AS_FALLBACK);
        }
        return false;
    }
497098
public static function load($class)
	{
		$class = static::normalizeClass($class);

		foreach (static::$directories as $directory)
		{
			if (file_exists($path = $directory . DIRECTORY_SEPARATOR . $class))
			{
				require_once $path;

				return true;
			}

			if (file_exists($path = $directory . DIRECTORY_SEPARATOR . strtolower($class)))
			{
				require_once $path;

				return true;
			}
		}

		return false;
	}
761685
public function output($return = true) {
        global $PAGE, $OUTPUT;
        static $template_printed;

        $this->initialise_javascript($PAGE);

        if (!empty(self::$nonjs)) {
            // return non js comments interface
            return $this->print_comments(self::$comment_page, $return, true);
        }

        $html = '';

        // print html template
        // Javascript will use the template to render new comments
        if (empty($template_printed) && $this->can_view()) {
            $html .= html_writer::tag('div', $this->template, array('style' => 'display:none', 'id' => 'cmt-tmpl'));
            $template_printed = true;
        }

        if ($this->can_view()) {
            // print commenting icon and tooltip
            $html .= html_writer::start_tag('div', array('class' => 'mdl-left'));
            $html .= html_writer::link($this->get_nojslink($PAGE), get_string('showcommentsnonjs'), array('class' => 'showcommentsnonjs'));

            if (!$this->notoggle) {
                // If toggling is enabled (notoggle=false) then print the controls to toggle
                // comments open and closed
                $countstring = '';
                if ($this->displaytotalcount) {
                    $countstring = '('.$this->count().')';
                }
                $collapsedimage= 't/collapsed';
                if (right_to_left()) {
                    $collapsedimage= 't/collapsed_rtl';
                } else {
                    $collapsedimage= 't/collapsed';
                }
                $html .= html_writer::start_tag('a', array(
                    'class' => 'comment-link',
                    'id' => 'comment-link-'.$this->cid,
                    'href' => '#',
                    'role' => 'button',
                    'aria-expanded' => 'false')
                );
                $html .= $OUTPUT->pix_icon($collapsedimage, $this->linktext);
                $html .= html_writer::tag('span', $this->linktext.' '.$countstring, array('id' => 'comment-link-text-'.$this->cid));
                $html .= html_writer::end_tag('a');
            }

            $html .= html_writer::start_tag('div', array('id' => 'comment-ctrl-'.$this->cid, 'class' => 'comment-ctrl'));

            if ($this->autostart) {
                // If autostart has been enabled print the comments list immediatly
                $html .= html_writer::start_tag('ul', array('id' => 'comment-list-'.$this->cid, 'class' => 'comment-list comments-loaded'));
                $html .= html_writer::tag('li', '', array('class' => 'first'));
                $html .= $this->print_comments(0, true, false);
                $html .= html_writer::end_tag('ul'); // .comment-list
                $html .= $this->get_pagination(0);
            } else {
                $html .= html_writer::start_tag('ul', array('id' => 'comment-list-'.$this->cid, 'class' => 'comment-list'));
                $html .= html_writer::tag('li', '', array('class' => 'first'));
                $html .= html_writer::end_tag('ul'); // .comment-list
                $html .= html_writer::tag('div', '', array('id' => 'comment-pagination-'.$this->cid, 'class' => 'comment-pagination'));
            }

            if ($this->can_post()) {
                // print posting textarea
                $textareaattrs = array(
                    'name' => 'content',
                    'rows' => 2,
                    'id' => 'dlg-content-'.$this->cid,
                    'aria-label' => get_string('addcomment')
                );
                if (!$this->fullwidth) {
                    $textareaattrs['cols'] = '20';
                } else {
                    $textareaattrs['class'] = 'fullwidth';
                }

                $html .= html_writer::start_tag('div', array('class' => 'comment-area'));
                $html .= html_writer::start_tag('div', array('class' => 'db'));
                $html .= html_writer::tag('textarea', '', $textareaattrs);
                $html .= html_writer::end_tag('div'); // .db

                $html .= html_writer::start_tag('div', array('class' => 'fd', 'id' => 'comment-action-'.$this->cid));
                $html .= html_writer::link('#', get_string('savecomment'), array('id' => 'comment-action-post-'.$this->cid));

                if ($this->displaycancel) {
                    $html .= html_writer::tag('span', ' | ');
                    $html .= html_writer::link('#', get_string('cancel'), array('id' => 'comment-action-cancel-'.$this->cid));
                }

                $html .= html_writer::end_tag('div'); // .fd
                $html .= html_writer::end_tag('div'); // .comment-area
                $html .= html_writer::tag('div', '', array('class' => 'clearer'));
            }

            $html .= html_writer::end_tag('div'); // .comment-ctrl
            $html .= html_writer::end_tag('div'); // .mdl-left
        } else {
            $html = '';
        }

        if ($return) {
            return $html;
        } else {
            echo $html;
        }
    }
47353
public function paragraph($contents, $class='') {
        $attributes = array();
        if ($class !== '') {
            $attributes['class'] = $class;
        }
        $output = html_writer::tag('p', $contents, $attributes);
        return $output;
    }
39241
public static function autoload($class)
  {
    if(substr($class, 0, strlen(__CLASS__)) != __CLASS__) return;

    try
    {
      self::loadClass($class);

      return TRUE;
    }
    catch(Exception $e)
    {
      return FALSE;
    }
  }
190335
public function getAllClasses($class, bool $autoload = true): array
    {
        if (is_object($class)) {
            $class = get_class($class);
        }

        if (!isset($this->classes[$class])) {
            $classes = array_merge([ltrim($class, '\\')],
                                   $resultClassParents = @class_parents($class, $autoload),
                                   $resultClassImplements = @class_implements($class, $autoload));

            if ($resultClassParents === false || $resultClassImplements === false) {
                throw new ClassIndexException(sprintf('Unable to get all classes of class "%s"', $class));
            }

            $this->classes[$class] = array_unique($classes);
        }

        return $this->classes[$class];
    }
1264348
protected static function classImplements(string $class, string $interface): bool
    {
        assert(class_exists($class));
        assert(interface_exists($interface));

        $implements = array_key_exists($interface, class_implements($class));

        return $implements;
    }
109932
public function autoload($class)
    {
        $filePath = $this->folder . '/' . str_replace('\\', '/', $class) . '.php';

        if (file_exists($filePath)) {
            return ( (require_once $filePath) === false ? true : false );
        }

        return false;
    }
455340
public static function executeCommand(string $class, ConsoleOutput $output, array $inputs) : int
    {
        if (!class_exists($class)) {
            throw new \RuntimeException((sprintf("Undefined class '%s'", $class)));
        }

        $command = new $class();

        if (!$command instanceof Command) {
            throw new \RuntimeException(sprintf("Invalid class '%s'", $class));
        }

        $input = new ArrayInput($inputs, $command->getDefinition());

        $command
            ->setInput($input)
            ->setOutput($output)
            ->setStart();

        return $command->execute($input, $output);
    }
1000005
public function resolveClassString(string $class, $factory = false)
    {
        if($factory === true) {
            return $this->resolveClass($class);
        }

        return $this->resolveClassFromCache($class);
    }
371063
public static function load($class)
	{
		// deal with funny is_callable('static::classname') side-effect
		if (strpos($class, 'static::') === 0)
		{
			// is called from within the class, so it's already loaded
			return true;
		}

		$loaded = false;
		$class = ltrim($class, '\\');
		$namespaced = ($pos = strripos($class, '\\')) !== false;

		if (empty(static::$auto_initialize))
		{
			static::$auto_initialize = $class;
		}

		if (isset(static::$classes[strtolower($class)]))
		{
			static::init_class($class, str_replace('/', DS, static::$classes[strtolower($class)]));
			$loaded = true;
		}
		elseif ($full_class = static::find_core_class($class))
		{
			if ( ! class_exists($full_class, false) and ! interface_exists($full_class, false))
			{
				include static::prep_path(static::$classes[strtolower($full_class)]);
			}
			if ( ! class_exists($class, false))
			{
				class_alias($full_class, $class);
			}
			static::init_class($class);
			$loaded = true;
		}
		else
		{
			$full_ns = substr($class, 0, $pos);

			if ($full_ns)
			{
				foreach (static::$namespaces as $ns => $path)
				{
					$ns = ltrim($ns, '\\');
					if (stripos($full_ns, $ns) === 0)
					{
						$path .= static::class_to_path(
							substr($class, strlen($ns) + 1),
							array_key_exists($ns, static::$psr_namespaces)
						);
						if (is_file($path))
						{
							static::init_class($class, $path);
							$loaded = true;
							break;
						}
					}
				}
			}

			if ( ! $loaded)
			{
				$path = APPPATH.'classes/'.static::class_to_path($class);

				if (is_file($path))
				{
					static::init_class($class, $path);
					$loaded = true;
				}
			}
		}

		// Prevent failed load from keeping other classes from initializing
		if (static::$auto_initialize == $class)
		{
			static::$auto_initialize = null;
		}

		return $loaded;
	}
610625
public function load($class)
    {
        if ($this->psr0 and $this->loadPsr0($class)) {
            return true;
        }
        $namespace = '\\';
        $classPath = str_replace('\\', '/', $class) . '.php';
        while (true) {
            if ($this->loadFrom($classPath, $namespace)) {
                return true;
            }
            $pos = strpos($classPath, '/');
            if ($pos === false) {
                if (! $this->psr0) {
                    break;
                }
                $pos = strpos($classPath, '_');
                if ($pos === false) {
                    break;
                }
            }
            $namespace = rtrim($namespace, '\\') . '\\' . substr($classPath, 0, $pos);
            $classPath = substr($classPath, $pos + 1);
        }
        return false;
    }
530868
public static function outputStyles($output = '')
    {
        self::lookIfProcessFiles('style', 'header');

        $template = self::$templates['style'];
        $styles = self::$data['style']['header'];

        foreach ($styles as $value) {
            $output .= sprintf(
                $template,
                $value['url']
            );
        }

        self::$data['style']['header'] = [];

        return ! empty($output) ? $output : false;
    }