[CLEANUP] Code cleanup in ext:reports
[Packages/TYPO3.CMS.git] / typo3 / sysext / reports / Classes / Report / Status / WarningMessagePostProcessor.php
index f1632b9..61354af 100644 (file)
@@ -13,6 +13,11 @@ namespace TYPO3\CMS\Reports\Report\Status;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\CMS\Core\Registry;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\LanguageService;
+use TYPO3\CMS\Reports\Status;
 
 /**
  * Post processes the warning messages found in about modules.
@@ -26,20 +31,22 @@ class WarningMessagePostProcessor
      * control over the system warning messages.
      *
      * @param array $warningMessages An array of messages related to already found issues.
+     * @return void
      */
     public function displayWarningMessages_postProcess(array &$warningMessages)
     {
-        if (!$GLOBALS['BE_USER']->isAdmin()) {
+        if (!$this->getBackendUser()->isAdmin()) {
             return;
         }
         // Get highest severity
-        $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Registry::class);
+        /** @var Registry $registry */
+        $registry = GeneralUtility::makeInstance(Registry::class);
         $highestSeverity = $registry->get('tx_reports', 'status.highestSeverity', null);
         if (!is_null($highestSeverity)) {
-            if ($highestSeverity > \TYPO3\CMS\Reports\Status::OK) {
+            if ($highestSeverity > Status::OK) {
                 // Display a message that there's something wrong and that
                 // the admin should take a look at the detailed status report
-                $GLOBALS['LANG']->includeLLFile('EXT:reports/Resources/Private/Language/locallang_reports.xlf');
+                $this->getLanguageService()->includeLLFile('EXT:reports/Resources/Private/Language/locallang_reports.xlf');
                 $reportModuleIdentifier = 'system_ReportsTxreportsm1';
                 $reportModuleParameters = array(
                     'tx_reports_system_reportstxreportsm1[extension]=tx_reports',
@@ -48,10 +55,27 @@ class WarningMessagePostProcessor
                     'tx_reports_system_reportstxreportsm1[controller]=Report',
                 );
                 $warningMessages['tx_reports_status_notification'] = sprintf(
-                    $GLOBALS['LANG']->getLL('status_problemNotification'),
-                    '<a href="javascript:top.goToModule(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($reportModuleIdentifier) . ', 1, ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue('&' . implode('&', $reportModuleParameters)) . ');">', '</a>'
+                    $this->getLanguageService()->getLL('status_problemNotification'),
+                    '<a href="javascript:top.goToModule(' . GeneralUtility::quoteJSvalue($reportModuleIdentifier) . ', 1, ' . GeneralUtility::quoteJSvalue('&' . implode('&', $reportModuleParameters)) . ');">',
+                    '</a>'
                 );
             }
         }
     }
+
+    /**
+     * @return LanguageService
+     */
+    protected function getLanguageService()
+    {
+        return $GLOBALS['LANG'];
+    }
+
+    /**
+     * @return BackendUserAuthentication
+     */
+    protected function getBackendUser()
+    {
+        return $GLOBALS['BE_USER'];
+    }
 }