static function classLink($className, $label = null)
    {
        $classDefinitions = $GLOBALS['PHPDocMD_classDefinitions'];
        $linkTemplate = $GLOBALS['PHPDocMD_linkTemplate'];

        $returnedClasses = [];

        foreach (explode('|', $className) as $oneClass) {
            $oneClass = trim($oneClass, '\\ ');

            if (!$label) {
                $label = $oneClass;
            }

            if (!isset($classDefinitions[$oneClass])) {
                $returnedClasses[] = $oneClass;
            } else {
                $link = str_replace('\\', '-', $oneClass);
                $link = strtr($linkTemplate, ['%c' => $link]);

                $returnedClasses[] = sprintf("[%s](%s)", $label, $link);
            }
        }

        return implode('|', $returnedClasses);
    }
static function classLink($className, $label = null)
    {
        $classDefinitions = $GLOBALS['PHPDocMD_classDefinitions'];
        $linkTemplate = $GLOBALS['PHPDocMD_linkTemplate'];

        $returnedClasses = [];

        foreach (explode('|', $className) as $oneClass) {
            $oneClass = trim($oneClass, '\\ ');

            if (!$label) {
                $label = $oneClass;
            }

            if (!isset($classDefinitions[$oneClass])) {
                $returnedClasses[] = $oneClass;
            } else {
                $link = str_replace('\\', '-', $oneClass);
                $link = strtr($linkTemplate, ['%c' => $link]);

                $returnedClasses[] = sprintf("[%s](%s)", $label, $link);
            }
        }

        return implode('|', $returnedClasses);
    }
static function classLink ( $ className , $ label = null ) { $ classDefinitions = $ GLOBALS [ 'PHPDocMD_classDefinitions' ] ; $ linkTemplate = $ GLOBALS [ 'PHPDocMD_linkTemplate' ] ; $ returnedClasses = [ ] ; foreach ( explode ( '|' , $ className ) as $ oneClass ) { $ oneClass = trim ( $ oneClass , '\\ ' ) ; if ( ! $ label ) { $ label = $ oneClass ; } if ( ! isset ( $ classDefinitions [ $ oneClass ] ) ) { $ returnedClasses [ ] = $ oneClass ; } else { $ link = str_replace ( '\\' , '-' , $ oneClass ) ; $ link = strtr ( $ linkTemplate , [ '%c' => $ link ] ) ; $ returnedClasses [ ] = sprintf ( "[%s](%s)" , $ label , $ link ) ; } } return implode ( '|' , $ returnedClasses ) ; }
This is a twig template function.

This function allows us to easily link classes to their existing pages.

Due to the unfortunate way twig works, this must be static, and we must use a global to
achieve our goal.

@param string      $className
@param null|string $label

@return string
This is a twig template function .