From 37ece89c3ddca4607781a68fda120ff880174dfe Mon Sep 17 00:00:00 2001
From: Benni Mack <benni@typo3.org>
Date: Thu, 10 May 2018 22:02:32 +0200
Subject: [PATCH] [TASK] Clean up TimeTracker usage in frontend requests

For historical purposes, TimeTracker->push() is
called with an empty string in the second parameter,
however, as this parameter is optional and set to ''
by default as well, the code readability can be improved
by just using the first parameter when using
TimeTracker->push()

Resolves: #84964
Releases: master
Change-Id: I37a338268f9b2df9f2a98414075d207b63dc542e
Reviewed-on: https://review.typo3.org/56913
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
---
 .../TypoScriptFrontendController.php           | 18 +++++++++---------
 .../frontend/Classes/Http/RequestHandler.php   |  2 +-
 .../PrepareTypoScriptFrontendRendering.php     |  6 +++---
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
index 6c4ea82a6aec..3bb1bdcad244 100644
--- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
+++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
@@ -1028,7 +1028,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         // we proceed and check if a backend user is logged in.
         if ($_COOKIE[BackendUserAuthentication::getCookieName()]) {
             $GLOBALS['TYPO3_MISC']['microtime_BE_USER_start'] = microtime(true);
-            $this->getTimeTracker()->push('Back End user initialized', '');
+            $this->getTimeTracker()->push('Back End user initialized');
             $this->beUserLogin = false;
             // New backend user object
             $backendUserObject = GeneralUtility::makeInstance(FrontendBackendUserAuthentication::class);
@@ -1258,7 +1258,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
     public function fetch_the_id()
     {
         $timeTracker = $this->getTimeTracker();
-        $timeTracker->push('fetch_the_id initialize/', '');
+        $timeTracker->push('fetch_the_id initialize/');
         // Initialize the page-select functions.
         $this->sys_page = GeneralUtility::makeInstance(PageRepository::class);
         $this->sys_page->versioningPreview = $this->whichWorkspace() > 0 || (bool)GeneralUtility::_GP('ADMCMD_view');
@@ -1275,7 +1275,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         $this->type = (int)$this->type;
         $timeTracker->pull();
         // We find the first page belonging to the current domain
-        $timeTracker->push('fetch_the_id domain/', '');
+        $timeTracker->push('fetch_the_id domain/');
         if (!$this->id) {
             if ($this->domainStartPage) {
                 // If the id was not previously set, set it to the id of the domain.
@@ -1298,7 +1298,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
             }
         }
         $timeTracker->pull();
-        $timeTracker->push('fetch_the_id rootLine/', '');
+        $timeTracker->push('fetch_the_id rootLine/');
         // We store the originally requested id
         $this->requestedId = $this->id;
         try {
@@ -2243,7 +2243,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
             if ($this->all) {
                 // we got page section information
                 $this->newHash = $this->getHash();
-                $this->getTimeTracker()->push('Cache Row', '');
+                $this->getTimeTracker()->push('Cache Row');
                 $row = $this->getFromCache_queryRow();
                 if (!is_array($row)) {
                     // nothing in the cache, we acquire an exclusive lock now
@@ -2315,7 +2315,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
      */
     public function getFromCache_queryRow()
     {
-        $this->getTimeTracker()->push('Cache Query', '');
+        $this->getTimeTracker()->push('Cache Query');
         $row = $this->pageCache->get($this->newHash);
         $this->getTimeTracker()->pull();
         return $row;
@@ -2421,14 +2421,14 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         // If config is not set by the cache (which would be a major mistake somewhere) OR if INTincScripts-include-scripts have been registered, then we must parse the template in order to get it
         if (empty($this->config) || is_array($this->config['INTincScript']) || $this->forceTemplateParsing) {
             $timeTracker = $this->getTimeTracker();
-            $timeTracker->push('Parse template', '');
+            $timeTracker->push('Parse template');
             // Force parsing, if set?:
             $this->tmpl->forceTemplateParsing = $this->forceTemplateParsing;
             // Start parsing the TS template. Might return cached version.
             $this->tmpl->start($this->rootLine);
             $timeTracker->pull();
             if ($this->tmpl->loaded) {
-                $timeTracker->push('Setting the config-array', '');
+                $timeTracker->push('Setting the config-array');
                 // toplevel - objArrayName
                 $this->sPre = $this->tmpl->setup['types.'][$this->type];
                 $this->pSetup = $this->tmpl->setup[$this->sPre . '.'];
@@ -3613,7 +3613,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
                 if (is_array($INTiS_config[$INTiS_key])) {
                     $label = 'Include ' . $INTiS_config[$INTiS_key]['type'];
                     $label = $label . isset($INTiS_config[$INTiS_key]['file']) ? ' ' . $INTiS_config[$INTiS_key]['file'] : '';
-                    $timeTracker->push($label, '');
+                    $timeTracker->push($label);
                     $incContent = '';
                     $INTiS_cObj = unserialize($INTiS_config[$INTiS_key]['cObj']);
                     /* @var $INTiS_cObj ContentObjectRenderer */
diff --git a/typo3/sysext/frontend/Classes/Http/RequestHandler.php b/typo3/sysext/frontend/Classes/Http/RequestHandler.php
index 9a517953aeb8..4954edb043df 100644
--- a/typo3/sysext/frontend/Classes/Http/RequestHandler.php
+++ b/typo3/sysext/frontend/Classes/Http/RequestHandler.php
@@ -98,7 +98,7 @@ class RequestHandler implements RequestHandlerInterface, PsrRequestHandlerInterf
         // Output content
         $isOutputting = $controller->isOutputting();
         if ($isOutputting) {
-            $this->timeTracker->push('Print Content', '');
+            $this->timeTracker->push('Print Content');
             $controller->processOutput();
             $this->timeTracker->pull();
         }
diff --git a/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php b/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php
index e67889a79d5a..45129c6609cb 100644
--- a/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php
+++ b/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php
@@ -57,11 +57,11 @@ class PrepareTypoScriptFrontendRendering implements MiddlewareInterface
     public function process(ServerRequestInterface $request, PsrRequestHandlerInterface $handler): ResponseInterface
     {
         // Starts the template
-        $this->timeTracker->push('Start Template', '');
+        $this->timeTracker->push('Start Template');
         $this->controller->initTemplate();
         $this->timeTracker->pull();
         // Get from cache
-        $this->timeTracker->push('Get Page from cache', '');
+        $this->timeTracker->push('Get Page from cache');
         // Locks may be acquired here
         $this->controller->getFromCache();
         $this->timeTracker->pull();
@@ -69,7 +69,7 @@ class PrepareTypoScriptFrontendRendering implements MiddlewareInterface
         // After this, we should have a valid config-array ready
         $this->controller->getConfigArray();
         // Setting language and locale
-        $this->timeTracker->push('Setting language and locale', '');
+        $this->timeTracker->push('Setting language and locale');
         $this->controller->settingLanguage();
         $this->controller->settingLocale();
         $this->timeTracker->pull();
-- 
GitLab