original_string: public static function getTSFE($id, $typeNum)
      {
          // Initialize the tracker if necessary
          if (!is_object($GLOBALS['TT'])) {
              $GLOBALS['TT'] = new TimeTracker(false);
              $GLOBALS['TT']->start();
          }
  
          if (!array_key_exists("$id/$typeNum", self::$frontendControllers)) {
              $tsfeBackup      = empty($GLOBALS['TSFE']) ? null : $GLOBALS['TSFE'];
              $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
                  TypoScriptFrontendController::class,
                  $GLOBALS['TYPO3_CONF_VARS'],
                  $id,
                  $typeNum
              );
  
              $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance(PageRepository::class);
              $GLOBALS['TSFE']->sys_page->init(true);
              $GLOBALS['TSFE']->connectToDB();
              $GLOBALS['TSFE']->initFEuser();
              $GLOBALS['TSFE']->determineId();
              $GLOBALS['TSFE']->initTemplate();
              $GLOBALS['TSFE']->rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($id, '');
  
              try {
                  $GLOBALS['TSFE']->getConfigArray();
              } catch (ServiceUnavailableException $e) {
                  // Skip unconfigured page type
              }
  
              // Calculate the absolute path prefix
              if (!empty($GLOBALS['TSFE']->config['config']['absRefPrefix'])) {
                  $absRefPrefix                  = trim($GLOBALS['TSFE']->config['config']['absRefPrefix']);
                  $GLOBALS['TSFE']->absRefPrefix = ($absRefPrefix === 'auto') ? GeneralUtility::getIndpEnv(
                      'TYPO3_SITE_PATH'
                  ) : $absRefPrefix;
              } else {
                  $GLOBALS['TSFE']->absRefPrefix = '';
              }
  
              self::$frontendControllers["$id/$typeNum"] = $GLOBALS['TSFE'];
  
              if ($tsfeBackup) {
                  $GLOBALS['TSFE'] = $tsfeBackup;
              } else {
                  unset($GLOBALS['TSFE']);
              }
          }
  
          return self::$frontendControllers["$id/$typeNum"];
      }
code: public static function getTSFE($id, $typeNum)
      {
          // Initialize the tracker if necessary
          if (!is_object($GLOBALS['TT'])) {
              $GLOBALS['TT'] = new TimeTracker(false);
              $GLOBALS['TT']->start();
          }
  
          if (!array_key_exists("$id/$typeNum", self::$frontendControllers)) {
              $tsfeBackup      = empty($GLOBALS['TSFE']) ? null : $GLOBALS['TSFE'];
              $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
                  TypoScriptFrontendController::class,
                  $GLOBALS['TYPO3_CONF_VARS'],
                  $id,
                  $typeNum
              );
  
              $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance(PageRepository::class);
              $GLOBALS['TSFE']->sys_page->init(true);
              $GLOBALS['TSFE']->connectToDB();
              $GLOBALS['TSFE']->initFEuser();
              $GLOBALS['TSFE']->determineId();
              $GLOBALS['TSFE']->initTemplate();
              $GLOBALS['TSFE']->rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($id, '');
  
              try {
                  $GLOBALS['TSFE']->getConfigArray();
              } catch (ServiceUnavailableException $e) {
                  // Skip unconfigured page type
              }
  
              // Calculate the absolute path prefix
              if (!empty($GLOBALS['TSFE']->config['config']['absRefPrefix'])) {
                  $absRefPrefix                  = trim($GLOBALS['TSFE']->config['config']['absRefPrefix']);
                  $GLOBALS['TSFE']->absRefPrefix = ($absRefPrefix === 'auto') ? GeneralUtility::getIndpEnv(
                      'TYPO3_SITE_PATH'
                  ) : $absRefPrefix;
              } else {
                  $GLOBALS['TSFE']->absRefPrefix = '';
              }
  
              self::$frontendControllers["$id/$typeNum"] = $GLOBALS['TSFE'];
  
              if ($tsfeBackup) {
                  $GLOBALS['TSFE'] = $tsfeBackup;
              } else {
                  unset($GLOBALS['TSFE']);
              }
          }
  
          return self::$frontendControllers["$id/$typeNum"];
      }
code_tokens: public static function getTSFE ( $ id , $ typeNum ) { // Initialize the tracker if necessary if ( ! is_object ( $ GLOBALS [ 'TT' ] ) ) { $ GLOBALS [ 'TT' ] = new TimeTracker ( false ) ; $ GLOBALS [ 'TT' ] -> start ( ) ; } if ( ! array_key_exists ( "$id/$typeNum" , self :: $ frontendControllers ) ) { $ tsfeBackup = empty ( $ GLOBALS [ 'TSFE' ] ) ? null : $ GLOBALS [ 'TSFE' ] ; $ GLOBALS [ 'TSFE' ] = GeneralUtility :: makeInstance ( TypoScriptFrontendController :: class , $ GLOBALS [ 'TYPO3_CONF_VARS' ] , $ id , $ typeNum ) ; $ GLOBALS [ 'TSFE' ] -> sys_page = GeneralUtility :: makeInstance ( PageRepository :: class ) ; $ GLOBALS [ 'TSFE' ] -> sys_page -> init ( true ) ; $ GLOBALS [ 'TSFE' ] -> connectToDB ( ) ; $ GLOBALS [ 'TSFE' ] -> initFEuser ( ) ; $ GLOBALS [ 'TSFE' ] -> determineId ( ) ; $ GLOBALS [ 'TSFE' ] -> initTemplate ( ) ; $ GLOBALS [ 'TSFE' ] -> rootLine = $ GLOBALS [ 'TSFE' ] -> sys_page -> getRootLine ( $ id , '' ) ; try { $ GLOBALS [ 'TSFE' ] -> getConfigArray ( ) ; } catch ( ServiceUnavailableException $ e ) { // Skip unconfigured page type } // Calculate the absolute path prefix if ( ! empty ( $ GLOBALS [ 'TSFE' ] -> config [ 'config' ] [ 'absRefPrefix' ] ) ) { $ absRefPrefix = trim ( $ GLOBALS [ 'TSFE' ] -> config [ 'config' ] [ 'absRefPrefix' ] ) ; $ GLOBALS [ 'TSFE' ] -> absRefPrefix = ( $ absRefPrefix === 'auto' ) ? GeneralUtility :: getIndpEnv ( 'TYPO3_SITE_PATH' ) : $ absRefPrefix ; } else { $ GLOBALS [ 'TSFE' ] -> absRefPrefix = '' ; } self :: $ frontendControllers [ "$id/$typeNum" ] = $ GLOBALS [ 'TSFE' ] ; if ( $ tsfeBackup ) { $ GLOBALS [ 'TSFE' ] = $ tsfeBackup ; } else { unset ( $ GLOBALS [ 'TSFE' ] ) ; } } return self :: $ frontendControllers [ "$id/$typeNum" ] ; }
docstring: Instantiate a Frontend controller for the given configuration
  
  @param int $id      Page ID
  @param int $typeNum Page Type
  
  @return TypoScriptFrontendController Frontend controller
  @throws \Exception
  @throws \TYPO3\CMS\Core\Error\Http\ServiceUnavailableException
docstring_tokens: Instantiate a Frontend controller for the given configuration