From f7b22543a56b0e0ba94b1bbe845e4921ab5f72a5 Mon Sep 17 00:00:00 2001
From: Wouter Wolters <typo3@wouterwolters.nl>
Date: Thu, 26 Feb 2015 23:25:32 +0100
Subject: [PATCH] [TASK] General code cleanup in ext:sv

Resolves: #65370
Releases: master
Change-Id: If444c38cf263b0e089adb155cf0d2da7eb4dd9f5
Reviewed-on: http://review.typo3.org/37299
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Classes/AbstractAuthenticationService.php | 18 ++---
 .../sv/Classes/AuthenticationService.php      | 69 +++++++++--------
 typo3/sysext/sv/Classes/LoginFormHook.php     | 15 ++--
 .../sv/Classes/Report/ServicesListReport.php  | 75 ++++++++++++-------
 4 files changed, 98 insertions(+), 79 deletions(-)

diff --git a/typo3/sysext/sv/Classes/AbstractAuthenticationService.php b/typo3/sysext/sv/Classes/AbstractAuthenticationService.php
index d5329fd23722..4cdf92d0f7d6 100644
--- a/typo3/sysext/sv/Classes/AbstractAuthenticationService.php
+++ b/typo3/sysext/sv/Classes/AbstractAuthenticationService.php
@@ -15,18 +15,19 @@ namespace TYPO3\CMS\Sv;
  */
 
 use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
+use TYPO3\CMS\Core\Service\AbstractService;
 
 /**
  * Authentication services class
  *
  * @author René Fritz <r.fritz@colorcube.de>
  */
-class AbstractAuthenticationService extends \TYPO3\CMS\Core\Service\AbstractService {
+class AbstractAuthenticationService extends AbstractService {
 
 	/**
 	 * User object
 	 *
-	 * @var \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication
+	 * @var AbstractUserAuthentication
 	 */
 	public $pObj;
 
@@ -128,12 +129,12 @@ class AbstractAuthenticationService extends \TYPO3\CMS\Core\Service\AbstractServ
 	 * @param int $type denotes which module that has submitted the entry. This is the current list:  1=tce_db; 2=tce_file; 3=system (eg. sys_history save); 4=modules; 254=Personal settings changed; 255=login / out action: 1=login, 2=logout, 3=failed login (+ errorcode 3), 4=failure_warning_email sent
 	 * @param int $action denotes which specific operation that wrote the entry (eg. 'delete', 'upload', 'update' and so on...). Specific for each $type. Also used to trigger update of the interface. (see the log-module for the meaning of each number !!)
 	 * @param int $error flag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin)
-	 * @param int $details_nr The message number. Specific for each $type and $action. in the future this will make it possible to translate errormessages to other languages
+	 * @param int $details_nr The message number. Specific for each $type and $action. in the future this will make it possible to translate error messages to other languages
 	 * @param string $details Default text that follows the message
 	 * @param array $data Data that follows the log. Might be used to carry special information. If an array the first 5 entries (0-4) will be sprintf'ed the details-text...
 	 * @param string $tablename Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
-	 * @param int $recuid Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
-	 * @param int $recpid Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
+	 * @param int|string $recuid Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
+	 * @param int|string $recpid Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
 	 * @return void
 	 */
 	public function writelog($type, $action, $error, $details_nr, $details, $data, $tablename = '', $recuid = '', $recpid = '') {
@@ -142,17 +143,12 @@ class AbstractAuthenticationService extends \TYPO3\CMS\Core\Service\AbstractServ
 		}
 	}
 
-	/*************************
-	 *
-	 * create/update user - EXPERIMENTAL
-	 *
-	 *************************/
 	/**
 	 * Get a user from DB by username
 	 *
 	 * @param string $username User name
 	 * @param string $extraWhere Additional WHERE clause: " AND ...
-	 * @param array $dbUserSetup User db table definition: $this->db_user
+	 * @param array|string $dbUserSetup User db table definition, or empty string for $this->db_user
 	 * @return mixed User array or FALSE
 	 */
 	public function fetchUserRecord($username, $extraWhere = '', $dbUserSetup = '') {
diff --git a/typo3/sysext/sv/Classes/AuthenticationService.php b/typo3/sysext/sv/Classes/AuthenticationService.php
index b9463b7611c1..eee657aa64c5 100644
--- a/typo3/sysext/sv/Classes/AuthenticationService.php
+++ b/typo3/sysext/sv/Classes/AuthenticationService.php
@@ -14,12 +14,14 @@ namespace TYPO3\CMS\Sv;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Authentication services class
  *
  * @author René Fritz <r.fritz@colorcube.de>
  */
-class AuthenticationService extends \TYPO3\CMS\Sv\AbstractAuthenticationService {
+class AuthenticationService extends AbstractAuthenticationService {
 
 	/**
 	 * Process the submitted credentials.
@@ -64,23 +66,23 @@ class AuthenticationService extends \TYPO3\CMS\Sv\AbstractAuthenticationService
 	 */
 	public function getUser() {
 		$user = FALSE;
-		if ($this->login['status'] == 'login') {
+		if ($this->login['status'] === 'login') {
 			if ($this->login['uident']) {
 				$user = $this->fetchUserRecord($this->login['uname']);
 				if (!is_array($user)) {
 					// Failed login attempt (no username found)
 					$this->writelog(255, 3, 3, 2, 'Login-attempt from %s (%s), username \'%s\' not found!!', array($this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']));
 					// Logout written to log
-					\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf('Login-attempt from %s (%s), username \'%s\' not found!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']), 'Core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING);
+					GeneralUtility::sysLog(sprintf('Login-attempt from %s (%s), username \'%s\' not found!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']), 'Core', GeneralUtility::SYSLOG_SEVERITY_WARNING);
 				} else {
 					if ($this->writeDevLog) {
-						\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('User found: ' . \TYPO3\CMS\Core\Utility\GeneralUtility::arrayToLogString($user, array($this->db_user['userid_column'], $this->db_user['username_column'])), \TYPO3\CMS\Sv\AuthenticationService::class);
+						GeneralUtility::devLog('User found: ' . GeneralUtility::arrayToLogString($user, array($this->db_user['userid_column'], $this->db_user['username_column'])), AuthenticationService::class);
 					}
 				}
 			} else {
 				// Failed Login attempt (no password given)
 				$this->writelog(255, 3, 3, 2, 'Login-attempt from %s (%s) for username \'%s\' with an empty password!', array($this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']));
-				\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf('Login-attempt from %s (%s), for username \'%s\' with an empty password!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']), 'Core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING);
+				GeneralUtility::sysLog(sprintf('Login-attempt from %s (%s), for username \'%s\' with an empty password!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']), 'Core', GeneralUtility::SYSLOG_SEVERITY_WARNING);
 			}
 		}
 		return $user;
@@ -108,18 +110,18 @@ class AuthenticationService extends \TYPO3\CMS\Sv\AbstractAuthenticationService
 				// Failed login attempt (wrong password) - write that to the log!
 				if ($this->writeAttemptLog) {
 					$this->writelog(255, 3, 3, 1, 'Login-attempt from %s (%s), username \'%s\', password not accepted!', array($this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']));
-					\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf('Login-attempt from %s (%s), username \'%s\', password not accepted!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']), 'Core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING);
+					GeneralUtility::sysLog(sprintf('Login-attempt from %s (%s), username \'%s\', password not accepted!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']), 'Core', GeneralUtility::SYSLOG_SEVERITY_WARNING);
 				}
 				if ($this->writeDevLog) {
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Password not accepted: ' . $this->login['uident'], \TYPO3\CMS\Sv\AuthenticationService::class, 2);
+					GeneralUtility::devLog('Password not accepted: ' . $this->login['uident'], AuthenticationService::class, 2);
 				}
 			}
 			// Checking the domain (lockToDomain)
-			if ($OK && $user['lockToDomain'] && $user['lockToDomain'] != $this->authInfo['HTTP_HOST']) {
+			if ($OK && $user['lockToDomain'] && $user['lockToDomain'] !== $this->authInfo['HTTP_HOST']) {
 				// Lock domain didn't match, so error:
 				if ($this->writeAttemptLog) {
 					$this->writelog(255, 3, 3, 1, 'Login-attempt from %s (%s), username \'%s\', locked domain \'%s\' did not match \'%s\'!', array($this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $user[$this->db_user['username_column']], $user['lockToDomain'], $this->authInfo['HTTP_HOST']));
-					\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf('Login-attempt from %s (%s), username \'%s\', locked domain \'%s\' did not match \'%s\'!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $user[$this->db_user['username_column']], $user['lockToDomain'], $this->authInfo['HTTP_HOST']), 'Core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING);
+					GeneralUtility::sysLog(sprintf('Login-attempt from %s (%s), username \'%s\', locked domain \'%s\' did not match \'%s\'!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $user[$this->db_user['username_column']], $user['lockToDomain'], $this->authInfo['HTTP_HOST']), 'Core', GeneralUtility::SYSLOG_SEVERITY_WARNING);
 				}
 				$OK = 0;
 			}
@@ -136,7 +138,7 @@ class AuthenticationService extends \TYPO3\CMS\Sv\AbstractAuthenticationService
 	 */
 	public function getGroups($user, $knownGroups) {
 		$groupDataArr = array();
-		if ($this->mode == 'getGroupsFE') {
+		if ($this->mode === 'getGroupsFE') {
 			$groups = array();
 			if (is_array($user) && $user[$this->db_user['usergroup_column']]) {
 				$groupList = $user[$this->db_user['usergroup_column']];
@@ -146,35 +148,31 @@ class AuthenticationService extends \TYPO3\CMS\Sv\AbstractAuthenticationService
 			// ADD group-numbers if the IPmask matches.
 			if (is_array($GLOBALS['TYPO3_CONF_VARS']['FE']['IPmaskMountGroups'])) {
 				foreach ($GLOBALS['TYPO3_CONF_VARS']['FE']['IPmaskMountGroups'] as $IPel) {
-					if ($this->authInfo['REMOTE_ADDR'] && $IPel[0] && \TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP($this->authInfo['REMOTE_ADDR'], $IPel[0])) {
+					if ($this->authInfo['REMOTE_ADDR'] && $IPel[0] && GeneralUtility::cmpIP($this->authInfo['REMOTE_ADDR'], $IPel[0])) {
 						$groups[] = (int)$IPel[1];
 					}
 				}
 			}
 			$groups = array_unique($groups);
-			if (count($groups)) {
+			if (!empty($groups)) {
 				$list = implode(',', $groups);
 				if ($this->writeDevLog) {
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Get usergroups with id: ' . $list, \TYPO3\CMS\Sv\AuthenticationService::class);
+					GeneralUtility::devLog('Get usergroups with id: ' . $list, __CLASS__);
 				}
 				$lockToDomain_SQL = ' AND (lockToDomain=\'\' OR lockToDomain IS NULL OR lockToDomain=\'' . $this->authInfo['HTTP_HOST'] . '\')';
-				if (!$this->authInfo['showHiddenRecords']) {
-					$hiddenP = 'AND hidden=0 ';
-				}
-				$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->db_groups['table'], 'deleted=0 ' . $hiddenP . ' AND uid IN (' . $list . ')' . $lockToDomain_SQL);
-				while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+				$hiddenP = !$this->authInfo['showHiddenRecords'] ? 'AND hidden=0 ' : '';
+				$res = $this->getDatabaseConnection()->exec_SELECTquery('*', $this->db_groups['table'], 'deleted=0 ' . $hiddenP . ' AND uid IN (' . $list . ')' . $lockToDomain_SQL);
+				while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
 					$groupDataArr[$row['uid']] = $row;
 				}
 				if ($res) {
-					$GLOBALS['TYPO3_DB']->sql_free_result($res);
+					$this->getDatabaseConnection()->sql_free_result($res);
 				}
 			} else {
 				if ($this->writeDevLog) {
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('No usergroups found.', \TYPO3\CMS\Sv\AuthenticationService::class, 2);
+					GeneralUtility::devLog('No usergroups found.', AuthenticationService::class, 2);
 				}
 			}
-		} elseif ($this->mode == 'getGroupsBE') {
-
 		}
 		return $groupDataArr;
 	}
@@ -193,36 +191,43 @@ class AuthenticationService extends \TYPO3\CMS\Sv\AbstractAuthenticationService
 	public function getSubGroups($grList, $idList = '', &$groups) {
 		// Fetching records of the groups in $grList (which are not blocked by lockedToDomain either):
 		$lockToDomain_SQL = ' AND (lockToDomain=\'\' OR lockToDomain IS NULL OR lockToDomain=\'' . $this->authInfo['HTTP_HOST'] . '\')';
-		if (!$this->authInfo['showHiddenRecords']) {
-			$hiddenP = 'AND hidden=0 ';
-		}
-		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,subgroup', 'fe_groups', 'deleted=0 ' . $hiddenP . ' AND uid IN (' . $grList . ')' . $lockToDomain_SQL);
+		$hiddenP = !$this->authInfo['showHiddenRecords'] ? 'AND hidden=0 ' : '';
+		$res = $this->getDatabaseConnection()->exec_SELECTquery('uid,subgroup', 'fe_groups', 'deleted=0 ' . $hiddenP . ' AND uid IN (' . $grList . ')' . $lockToDomain_SQL);
 		// Internal group record storage
 		$groupRows = array();
 		// The groups array is filled
-		while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+		while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
 			if (!in_array($row['uid'], $groups)) {
 				$groups[] = $row['uid'];
 			}
 			$groupRows[$row['uid']] = $row;
 		}
 		// Traversing records in the correct order
-		$include_staticArr = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $grList);
+		$include_staticArr = GeneralUtility::intExplode(',', $grList);
 		// traversing list
 		foreach ($include_staticArr as $uid) {
 			// Get row:
 			$row = $groupRows[$uid];
 			// Must be an array and $uid should not be in the idList, because then it is somewhere previously in the grouplist
-			if (is_array($row) && !\TYPO3\CMS\Core\Utility\GeneralUtility::inList($idList, $uid)) {
+			if (is_array($row) && !GeneralUtility::inList($idList, $uid)) {
 				// Include sub groups
 				if (trim($row['subgroup'])) {
 					// Make integer list
-					$theList = implode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $row['subgroup']));
-					// Call recursively, pass along list of already processed groups so they are not recursed again.
+					$theList = implode(',', GeneralUtility::intExplode(',', $row['subgroup']));
+					// Call recursively, pass along list of already processed groups so they are not processed again.
 					$this->getSubGroups($theList, $idList . ',' . $uid, $groups);
 				}
 			}
 		}
 	}
 
-}
\ No newline at end of file
+	/**
+	 * Returns the database connection
+	 *
+	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
+	 */
+	protected function getDatabaseConnection() {
+		return $GLOBALS['TYPO3_DB'];
+	}
+
+}
diff --git a/typo3/sysext/sv/Classes/LoginFormHook.php b/typo3/sysext/sv/Classes/LoginFormHook.php
index e3a5beac3b3a..1259893164ea 100644
--- a/typo3/sysext/sv/Classes/LoginFormHook.php
+++ b/typo3/sysext/sv/Classes/LoginFormHook.php
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Sv;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Controller\LoginController;
+
 /**
  * This class contains a BE login form hook. It adds all necessary JavaScript
  * for the superchallenged authentication.
@@ -26,10 +28,10 @@ class LoginFormHook {
 	 * Provides form code for the superchallenged authentication.
 	 *
 	 * @param array $params Parameters to the script
-	 * @param \TYPO3\CMS\Backend\Controller\LoginController $pObj Calling object
+	 * @param LoginController $pObj Calling object
 	 * @return string The code for the login form
 	 */
-	public function getLoginFormTag(array $params, \TYPO3\CMS\Backend\Controller\LoginController &$pObj) {
+	public function getLoginFormTag(array $params, LoginController &$pObj) {
 		// Get the code according to the login level
 		switch ($pObj->loginSecurityLevel) {
 			case 'challenged':
@@ -51,12 +53,12 @@ class LoginFormHook {
 	 * Provides form code for the superchallenged authentication.
 	 *
 	 * @param array $params Parameters to the script
-	 * @param \TYPO3\CMS\Backend\Controller\LoginController $pObj Calling object
+	 * @param LoginController $pObj Calling object
 	 * @return string The code for the login form
 	 */
-	public function getLoginScripts(array $params, \TYPO3\CMS\Backend\Controller\LoginController &$pObj) {
+	public function getLoginScripts(array $params, LoginController &$pObj) {
 		$content = '';
-		if ($pObj->loginSecurityLevel == 'superchallenged' || $pObj->loginSecurityLevel == 'challenged') {
+		if ($pObj->loginSecurityLevel === 'superchallenged' || $pObj->loginSecurityLevel === 'challenged') {
 			$content = '
 				<script type="text/javascript" src="sysext/backend/Resources/Public/JavaScript/md5.js"></script>
 				' . $GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
@@ -83,8 +85,7 @@ class LoginFormHook {
 	 * @return string Challenge value
 	 */
 	protected function getChallenge() {
-		$challenge = md5(uniqid('', TRUE) . getmypid());
-		return $challenge;
+		return md5(uniqid('', TRUE) . getmypid());
 	}
 
 }
diff --git a/typo3/sysext/sv/Classes/Report/ServicesListReport.php b/typo3/sysext/sv/Classes/Report/ServicesListReport.php
index da08770da563..bc27bb43468a 100644
--- a/typo3/sysext/sv/Classes/Report/ServicesListReport.php
+++ b/typo3/sysext/sv/Classes/Report/ServicesListReport.php
@@ -14,29 +14,36 @@ namespace TYPO3\CMS\Sv\Report;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Exception;
+use TYPO3\CMS\Core\Utility\CommandUtility;
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Reports\Controller\ReportController;
+use TYPO3\CMS\Reports\ReportInterface;
+
 /**
  * This class provides a report displaying a list of all installed services
  * Code inspired by EXT:dam/lib/class.tx_dam_svlist.php by René Fritz
  *
  * @author Francois Suter <francois@typo3.org>
  */
-class ServicesListReport implements \TYPO3\CMS\Reports\ReportInterface {
+class ServicesListReport implements ReportInterface {
 
 	/**
 	 * Back-reference to the calling reports module
 	 *
-	 * @var \TYPO3\CMS\Reports\Controller\ReportController
+	 * @var ReportController
 	 */
 	protected $reportsModule;
 
 	/**
 	 * Constructor
 	 *
-	 * @param \TYPO3\CMS\Reports\Controller\ReportController $reportsModule Back-reference to the calling reports module
+	 * @param ReportController $reportsModule Back-reference to the calling reports module
 	 */
-	public function __construct(\TYPO3\CMS\Reports\Controller\ReportController $reportsModule) {
+	public function __construct(ReportController $reportsModule) {
 		$this->reportsModule = $reportsModule;
-		$GLOBALS['LANG']->includeLLFile('EXT:sv/Resources/Private/Language/locallang.xlf');
+		$this->getLanguageService()->includeLLFile('EXT:sv/Resources/Private/Language/locallang.xlf');
 	}
 
 	/**
@@ -58,8 +65,8 @@ class ServicesListReport implements \TYPO3\CMS\Reports\ReportInterface {
 	 * @return string The help content for this module.
 	 */
 	protected function renderHelp() {
-		$help = '<p class="lead">' . $GLOBALS['LANG']->getLL('report_explanation') . '</p>';
-		$help .= '<p class="help">' . $GLOBALS['LANG']->getLL('externals_explanation') . '</p>';
+		$help = '<p class="lead">' . $this->getLanguageService()->getLL('report_explanation') . '</p>';
+		$help .= '<p class="help">' . $this->getLanguageService()->getLL('externals_explanation') . '</p>';
 		return $help;
 	}
 
@@ -85,18 +92,19 @@ class ServicesListReport implements \TYPO3\CMS\Reports\ReportInterface {
 	 * @return string Service list as HTML for one service type
 	 */
 	protected function renderServiceTypeList($serviceType, $services) {
-		$header = '<h3>' . sprintf($GLOBALS['LANG']->getLL('service_type'), $serviceType) . '</h3>';
+		$lang = $this->getLanguageService();
+		$header = '<h3>' . sprintf($lang->getLL('service_type'), $serviceType) . '</h3>';
 		$serviceList = '
 			<table class="table table-striped table-hover tx_sv_reportlist">
 				<thead>
 					<tr>
-						<td style="width: 35%">' . $GLOBALS['LANG']->getLL('service') . '</td>
-						<td>' . $GLOBALS['LANG']->getLL('priority') . '</td>
-						<td>' . $GLOBALS['LANG']->getLL('quality') . '</td>
-						<td style="width: 35%">' . $GLOBALS['LANG']->getLL('subtypes') . '</td>
-						<td>' . $GLOBALS['LANG']->getLL('os') . '</td>
-						<td>' . $GLOBALS['LANG']->getLL('externals') . '</td>
-						<td>' . $GLOBALS['LANG']->getLL('available') . '</td>
+						<td style="width: 35%">' . $lang->getLL('service') . '</td>
+						<td>' . $lang->getLL('priority') . '</td>
+						<td>' . $lang->getLL('quality') . '</td>
+						<td style="width: 35%">' . $lang->getLL('subtypes') . '</td>
+						<td>' . $lang->getLL('os') . '</td>
+						<td>' . $lang->getLL('externals') . '</td>
+						<td>' . $lang->getLL('available') . '</td>
 					</tr>
 				</thead>
 			<tbody>';
@@ -128,17 +136,17 @@ class ServicesListReport implements \TYPO3\CMS\Reports\ReportInterface {
 			$serviceDescription .= '<p class="service-description">' . $serviceInformation['description'] . '</p>';
 		}
 		$serviceSubtypes = $serviceInformation['serviceSubTypes'] ? implode(', ', $serviceInformation['serviceSubTypes']) : '-';
-		$serviceOperatingSystem = $serviceInformation['os'] ?: $GLOBALS['LANG']->getLL('any');
+		$serviceOperatingSystem = $serviceInformation['os'] ?: $this->getLanguageService()->getLL('any');
 		$serviceRequiredExecutables = $serviceInformation['exec'] ?: '-';
 		$serviceAvailabilityClass = 'danger';
-		$serviceAvailable = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:no');
+		$serviceAvailable = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:no');
 		try {
-			$serviceDetails = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::findServiceByKey($serviceKey);
+			$serviceDetails = ExtensionManagementUtility::findServiceByKey($serviceKey);
 			if ($serviceDetails['available']) {
 				$serviceAvailabilityClass = 'success';
-				$serviceAvailable = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:yes');
+				$serviceAvailable = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:yes');
 			}
-		} catch (\TYPO3\CMS\Core\Exception $e) {
+		} catch (Exception $e) {
 
 		}
 		$serviceRow = '
@@ -160,30 +168,30 @@ class ServicesListReport implements \TYPO3\CMS\Reports\ReportInterface {
 	 * @return string HTML to display
 	 */
 	protected function renderExecutablesSearchPathList() {
-		$searchPaths = \TYPO3\CMS\Core\Utility\CommandUtility::getPaths(TRUE);
-		$content = '<h3>' . $GLOBALS['LANG']->getLL('search_paths') . '</h3>';
-		if (count($searchPaths) == 0) {
-			$content .= '<p>' . $GLOBALS['LANG']->getLL('no_search_paths') . '</p>';
+		$searchPaths = CommandUtility::getPaths(TRUE);
+		$content = '<h3>' . $this->getLanguageService()->getLL('search_paths') . '</h3>';
+		if (count($searchPaths) === 0) {
+			$content .= '<p>' . $this->getLanguageService()->getLL('no_search_paths') . '</p>';
 		} else {
 			$content .= '
 			<table class="table table-striped table-hover tx_sv_reportlist">
 				<thead>
 					<tr>
-						<td>' . $GLOBALS['LANG']->getLL('path') . '</td>
-						<td>' . $GLOBALS['LANG']->getLL('valid') . '</td>
+						<td>' . $this->getLanguageService()->getLL('path') . '</td>
+						<td>' . $this->getLanguageService()->getLL('valid') . '</td>
 					</tr>
 				</thead>
 				<tbody>';
 			foreach ($searchPaths as $path => $isValid) {
 				$pathAccessibleClass = 'danger';
-				$pathAccessible = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:no');
+				$pathAccessible = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:no');
 				if ($isValid) {
 					$pathAccessibleClass = 'success';
-					$pathAccessible = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:yes');
+					$pathAccessible = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:yes');
 				}
 				$content .= '
 					<tr class="' . $pathAccessibleClass . '">
-						<td class="first-cell">' . \TYPO3\CMS\Core\Utility\GeneralUtility::fixWindowsFilePath($path) . '</td>
+						<td class="first-cell">' . GeneralUtility::fixWindowsFilePath($path) . '</td>
 						<td class="last-cell">' . $pathAccessible . '</td>
 					</tr>';
 			}
@@ -245,4 +253,13 @@ class ServicesListReport implements \TYPO3\CMS\Reports\ReportInterface {
 		return $result;
 	}
 
+	/**
+	 * Returns LanguageService
+	 *
+	 * @return \TYPO3\CMS\Lang\LanguageService
+	 */
+	protected function getLanguageService() {
+		return $GLOBALS['LANG'];
+	}
+
 }
-- 
GitLab