public static function getLegacyTemplatesList(\Closure $legacyKernel)
    {
        $templateList = ['compact' => [], 'full' => []];
        // Only retrieve legacy templates list if the kernel has been booted at least once.
        if (!LegacyKernel::hasInstance()) {
            return $templateList;
        }

        try {
            $templateStats = $legacyKernel()->runCallback(
                static function () {
                    if (eZTemplate::isTemplatesUsageStatisticsEnabled()) {
                        return eZTemplate::templatesUsageStatistics();
                    } else {
                        $stats = [];
                        foreach (eZTemplate::instance()->templateFetchList() as $tpl) {
                            $stats[] = [
                                'requested-template-name' => $tpl,
                                'actual-template-name' => $tpl,
                                'template-filename' => $tpl,
                            ];
                        }

                        return $stats;
                    }
                },
                false,
                false
            );
        } catch (RuntimeException $e) {
            // Ignore the exception thrown by legacy kernel as this would break debug toolbar (and thus debug info display).
            // Furthermore, some legacy kernel handlers don't support runCallback (e.g. ezpKernelTreeMenu)
            $templateStats = [];
        }

        foreach ($templateStats as $tplInfo) {
            $requestedTpl = $tplInfo['requested-template-name'];
            $actualTpl = $tplInfo['actual-template-name'];
            $fullPath = $tplInfo['template-filename'];

            $templateList['full'][$actualTpl] = [
                'loaded' => $requestedTpl,
                'fullPath' => $fullPath,
            ];
            if (!isset($templateList['compact'][$actualTpl])) {
                $templateList['compact'][$actualTpl] = 1;
            } else {
                ++$templateList['compact'][$actualTpl];
            }
        }

        return $templateList;
    }
public static function getLegacyTemplatesList(\Closure $legacyKernel)
    {
        $templateList = ['compact' => [], 'full' => []];
        // Only retrieve legacy templates list if the kernel has been booted at least once.
        if (!LegacyKernel::hasInstance()) {
            return $templateList;
        }

        try {
            $templateStats = $legacyKernel()->runCallback(
                static function () {
                    if (eZTemplate::isTemplatesUsageStatisticsEnabled()) {
                        return eZTemplate::templatesUsageStatistics();
                    } else {
                        $stats = [];
                        foreach (eZTemplate::instance()->templateFetchList() as $tpl) {
                            $stats[] = [
                                'requested-template-name' => $tpl,
                                'actual-template-name' => $tpl,
                                'template-filename' => $tpl,
                            ];
                        }

                        return $stats;
                    }
                },
                false,
                false
            );
        } catch (RuntimeException $e) {
            // Ignore the exception thrown by legacy kernel as this would break debug toolbar (and thus debug info display).
            // Furthermore, some legacy kernel handlers don't support runCallback (e.g. ezpKernelTreeMenu)
            $templateStats = [];
        }

        foreach ($templateStats as $tplInfo) {
            $requestedTpl = $tplInfo['requested-template-name'];
            $actualTpl = $tplInfo['actual-template-name'];
            $fullPath = $tplInfo['template-filename'];

            $templateList['full'][$actualTpl] = [
                'loaded' => $requestedTpl,
                'fullPath' => $fullPath,
            ];
            if (!isset($templateList['compact'][$actualTpl])) {
                $templateList['compact'][$actualTpl] = 1;
            } else {
                ++$templateList['compact'][$actualTpl];
            }
        }

        return $templateList;
    }
public static function getLegacyTemplatesList ( \ Closure $ legacyKernel ) { $ templateList = [ 'compact' => [ ] , 'full' => [ ] ] ; // Only retrieve legacy templates list if the kernel has been booted at least once. if ( ! LegacyKernel :: hasInstance ( ) ) { return $ templateList ; } try { $ templateStats = $ legacyKernel ( ) -> runCallback ( static function ( ) { if ( eZTemplate :: isTemplatesUsageStatisticsEnabled ( ) ) { return eZTemplate :: templatesUsageStatistics ( ) ; } else { $ stats = [ ] ; foreach ( eZTemplate :: instance ( ) -> templateFetchList ( ) as $ tpl ) { $ stats [ ] = [ 'requested-template-name' => $ tpl , 'actual-template-name' => $ tpl , 'template-filename' => $ tpl , ] ; } return $ stats ; } } , false , false ) ; } catch ( RuntimeException $ e ) { // Ignore the exception thrown by legacy kernel as this would break debug toolbar (and thus debug info display). // Furthermore, some legacy kernel handlers don't support runCallback (e.g. ezpKernelTreeMenu) $ templateStats = [ ] ; } foreach ( $ templateStats as $ tplInfo ) { $ requestedTpl = $ tplInfo [ 'requested-template-name' ] ; $ actualTpl = $ tplInfo [ 'actual-template-name' ] ; $ fullPath = $ tplInfo [ 'template-filename' ] ; $ templateList [ 'full' ] [ $ actualTpl ] = [ 'loaded' => $ requestedTpl , 'fullPath' => $ fullPath , ] ; if ( ! isset ( $ templateList [ 'compact' ] [ $ actualTpl ] ) ) { $ templateList [ 'compact' ] [ $ actualTpl ] = 1 ; } else { ++ $ templateList [ 'compact' ] [ $ actualTpl ] ; } } return $ templateList ; }
Returns array of loaded legacy templates.

@param \Closure $legacyKernel

@return array
Returns array of loaded legacy templates .