From 72b3e9ea0d327c1f634dcb4c743f26e0518034ea Mon Sep 17 00:00:00 2001
From: Benni Mack <benni@typo3.org>
Date: Tue, 2 Jul 2019 18:31:44 +0200
Subject: [PATCH] [TASK] Streamline PageRenderer class

Some methods are not in use anymore, and also
some FQCN can be shortened in order to
clean up this class for further refactorings.

Resolves: #88673
Releases: master
Change-Id: I642caec9386945d0217984b76f586a9a24e13d14
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61214
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Alexander Schnitzler <review.typo3.org@alexanderschnitzler.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Sven Juergens <typo3@blue-side.de>
Reviewed-by: Alexander Schnitzler <review.typo3.org@alexanderschnitzler.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
---
 .../sysext/core/Classes/Page/PageRenderer.php | 30 +++++++------------
 1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/typo3/sysext/core/Classes/Page/PageRenderer.php b/typo3/sysext/core/Classes/Page/PageRenderer.php
index f161375b360e..4e1a8558db52 100644
--- a/typo3/sysext/core/Classes/Page/PageRenderer.php
+++ b/typo3/sysext/core/Classes/Page/PageRenderer.php
@@ -20,19 +20,21 @@ use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Core\Cache\CacheManager;
 use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
 use TYPO3\CMS\Core\Core\Environment;
+use TYPO3\CMS\Core\Localization\Locales;
 use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry;
+use TYPO3\CMS\Core\Resource\ResourceCompressor;
 use TYPO3\CMS\Core\Service\MarkerBasedTemplateService;
+use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
-use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
 
 /**
  * TYPO3 pageRender class
  * This class render the HTML of a webpage, usable for BE and FE
  */
-class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
+class PageRenderer implements SingletonInterface
 {
     // Constants for the part to be rendered
     const PART_COMPLETE = 0;
@@ -73,7 +75,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
     protected $moveJsFromHeaderToFooter = false;
 
     /**
-     * @var \TYPO3\CMS\Core\Localization\Locales
+     * @var Locales
      */
     protected $locales;
 
@@ -94,7 +96,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
     protected $languageDependencies = [];
 
     /**
-     * @var \TYPO3\CMS\Core\Resource\ResourceCompressor
+     * @var ResourceCompressor
      */
     protected $compressor;
 
@@ -333,7 +335,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
     public function __construct($templateFile = '')
     {
         $this->reset();
-        $this->locales = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\Locales::class);
+        $this->locales = GeneralUtility::makeInstance(Locales::class);
         if ($templateFile !== '') {
             $this->templateFile = $templateFile;
         }
@@ -1705,7 +1707,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
      * of uncached content objects (USER_INT, COA_INT)
      *
      * @param string $cachedPageContent
-     * @param string $substituteHash The hash that is used for the placehoder markers
+     * @param string $substituteHash The hash that is used for the variables
      * @internal
      * @return string
      */
@@ -2448,12 +2450,12 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
     /**
      * Returns instance of \TYPO3\CMS\Core\Resource\ResourceCompressor
      *
-     * @return \TYPO3\CMS\Core\Resource\ResourceCompressor
+     * @return ResourceCompressor
      */
     protected function getCompressor()
     {
         if ($this->compressor === null) {
-            $this->compressor = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\ResourceCompressor::class);
+            $this->compressor = GeneralUtility::makeInstance(ResourceCompressor::class);
         }
         return $this->compressor;
     }
@@ -2513,7 +2515,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
      *
      * @param string $file
      * @return string
-     * @see TypoScriptFrontendController::setAbsRefPrefix()
+     * @see \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::setAbsRefPrefix()
      */
     protected function getAbsoluteWebPath(string $file): string
     {
@@ -2523,16 +2525,6 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
         return PathUtility::getAbsoluteWebPath($file);
     }
 
-    /**
-     * Returns global frontend controller
-     *
-     * @return TypoScriptFrontendController
-     */
-    protected function getTypoScriptFrontendController()
-    {
-        return $GLOBALS['TSFE'];
-    }
-
     /*****************************************************/
     /*                                                   */
     /*  Hooks                                            */
-- 
GitLab