[TASK] EXT:lang CodeCleanup 49/45049/5
authorMichael Oehlhof <typo3@oehlhof.de>
Sun, 29 Nov 2015 11:48:10 +0000 (12:48 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Fri, 8 Jan 2016 18:30:31 +0000 (19:30 +0100)
Resolves: #71961
Releases: master
Change-Id: Id63cfbda5b471fa7a3b5eefb8cd89f70b9f06abd
Reviewed-on: https://review.typo3.org/45049
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
12 files changed:
typo3/sysext/lang/Classes/Command/LanguageCommandController.php
typo3/sysext/lang/Classes/Controller/LanguageController.php
typo3/sysext/lang/Classes/Domain/Model/Extension.php
typo3/sysext/lang/Classes/Domain/Model/Language.php
typo3/sysext/lang/Classes/Domain/Repository/ExtensionRepository.php
typo3/sysext/lang/Classes/Domain/Repository/LanguageRepository.php
typo3/sysext/lang/Classes/LanguageService.php
typo3/sysext/lang/Classes/Service/RegistryService.php
typo3/sysext/lang/Classes/Service/TerService.php
typo3/sysext/lang/Classes/Service/TranslationService.php
typo3/sysext/lang/Classes/View/AbstractJsonView.php
typo3/sysext/lang/Classes/View/Language/GetTranslationsJson.php

index 47e86ff..e91f420 100644 (file)
@@ -16,11 +16,17 @@ namespace TYPO3\CMS\Lang\Command;
 
 use TYPO3\CMS\Core\Package\PackageInterface;
 use TYPO3\CMS\Core\Package\PackageManager;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
+use TYPO3\CMS\Lang\Domain\Repository\LanguageRepository;
+use TYPO3\CMS\Lang\Service\RegistryService;
+use TYPO3\CMS\Lang\Service\TranslationService;
 
 /**
  * Language command controller updates translation packages
  */
-class LanguageCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandController
+class LanguageCommandController extends CommandController
 {
     /**
      * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
@@ -35,7 +41,7 @@ class LanguageCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\Comman
     /**
      * @param \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher
      */
-    public function injectSignalSlotDispatcher(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher)
+    public function injectSignalSlotDispatcher(Dispatcher $signalSlotDispatcher)
     {
         $this->signalSlotDispatcher = $signalSlotDispatcher;
     }
@@ -43,7 +49,7 @@ class LanguageCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\Comman
     /**
      * @param \TYPO3\CMS\Lang\Service\RegistryService $registryService
      */
-    public function injectRegistryService(\TYPO3\CMS\Lang\Service\RegistryService $registryService)
+    public function injectRegistryService(RegistryService $registryService)
     {
         $this->registryService = $registryService;
     }
@@ -57,12 +63,12 @@ class LanguageCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\Comman
     public function updateCommand($localesToUpdate = '')
     {
         /** @var $translationService \TYPO3\CMS\Lang\Service\TranslationService */
-        $translationService = $this->objectManager->get(\TYPO3\CMS\Lang\Service\TranslationService::class);
+        $translationService = $this->objectManager->get(TranslationService::class);
         /** @var $languageRepository \TYPO3\CMS\Lang\Domain\Repository\LanguageRepository */
-        $languageRepository = $this->objectManager->get(\TYPO3\CMS\Lang\Domain\Repository\LanguageRepository::class);
+        $languageRepository = $this->objectManager->get(LanguageRepository::class);
         $locales = array();
         if (!empty($localesToUpdate)) {
-            $locales = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $localesToUpdate, true);
+            $locales = GeneralUtility::trimExplode(',', $localesToUpdate, true);
         } else {
             $languages = $languageRepository->findSelected();
             foreach ($languages as $language) {
@@ -71,7 +77,7 @@ class LanguageCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\Comman
             }
         }
         /** @var PackageManager $packageManager */
-        $packageManager = $this->objectManager->get(\TYPO3\CMS\Core\Package\PackageManager::class);
+        $packageManager = $this->objectManager->get(PackageManager::class);
         $this->emitPackagesMayHaveChangedSignal();
         $packages = $packageManager->getAvailablePackages();
         $this->outputLine((sprintf('Updating language packs of all activated extensions for locales "%s"', implode(', ', $locales))));
index d962bf6..d54d000 100644 (file)
@@ -13,12 +13,18 @@ namespace TYPO3\CMS\Lang\Controller;
  *
  * The TYPO3 project - inspiring people to share!
  */
+
 use TYPO3\CMS\Backend\Template\Components\ButtonBar;
 use TYPO3\CMS\Backend\Template\Components\Menu\Menu;
 use TYPO3\CMS\Backend\Template\Components\Menu\MenuItem;
 use TYPO3\CMS\Backend\View\BackendTemplateView;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\Domain\Model\Extension;
+use TYPO3\CMS\Lang\Domain\Repository\ExtensionRepository;
+use TYPO3\CMS\Lang\Domain\Repository\LanguageRepository;
+use TYPO3\CMS\Lang\Service\RegistryService;
+use TYPO3\CMS\Lang\Service\TranslationService;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
 use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
 use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
@@ -61,7 +67,7 @@ class LanguageController extends ActionController
     /**
      * @param \TYPO3\CMS\Lang\Domain\Repository\LanguageRepository $languageRepository
      */
-    public function injectLanguageRepository(\TYPO3\CMS\Lang\Domain\Repository\LanguageRepository $languageRepository)
+    public function injectLanguageRepository(LanguageRepository $languageRepository)
     {
         $this->languageRepository = $languageRepository;
     }
@@ -69,7 +75,7 @@ class LanguageController extends ActionController
     /**
      * @param \TYPO3\CMS\Lang\Domain\Repository\ExtensionRepository $extensionRepository
      */
-    public function injectExtensionRepository(\TYPO3\CMS\Lang\Domain\Repository\ExtensionRepository $extensionRepository)
+    public function injectExtensionRepository(ExtensionRepository $extensionRepository)
     {
         $this->extensionRepository = $extensionRepository;
     }
@@ -77,7 +83,7 @@ class LanguageController extends ActionController
     /**
      * @param \TYPO3\CMS\Lang\Service\TranslationService $translationService
      */
-    public function injectTranslationService(\TYPO3\CMS\Lang\Service\TranslationService $translationService)
+    public function injectTranslationService(TranslationService $translationService)
     {
         $this->translationService = $translationService;
     }
@@ -85,7 +91,7 @@ class LanguageController extends ActionController
     /**
      * @param \TYPO3\CMS\Lang\Service\RegistryService $registryService
      */
-    public function injectRegistryService(\TYPO3\CMS\Lang\Service\RegistryService $registryService)
+    public function injectRegistryService(RegistryService $registryService)
     {
         $this->registryService = $registryService;
     }
@@ -141,10 +147,12 @@ class LanguageController extends ActionController
             'success' => false,
             'progress' => 0,
         );
+        $progress = 0;
         if (!empty($data['locale'])) {
             $allCount = 0;
             for ($i = 0; $i < $numberOfExtensionsToUpdate; $i++) {
                 $offset = (int)$data['count'] * $numberOfExtensionsToUpdate + $i;
+                /** @var Extension $extension */
                 $extension = $this->extensionRepository->findOneByOffset($offset);
                 if (empty($extension)) {
                     // No more extensions to update
index 39f955b..352324e 100644 (file)
@@ -14,10 +14,13 @@ namespace TYPO3\CMS\Lang\Domain\Model;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\VersionNumberUtility;
+use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
+
 /**
  * Extension model
  */
-class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
+class Extension extends AbstractEntity
 {
     /**
      * @var string
@@ -183,7 +186,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
      */
     public function setVersionFromString($version)
     {
-        $this->version = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($version);
+        $this->version = VersionNumberUtility::convertVersionNumberToInteger($version);
     }
 
     /**
index 6ec576f..451b3c7 100644 (file)
@@ -14,10 +14,12 @@ namespace TYPO3\CMS\Lang\Domain\Model;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
+
 /**
  * Language model
  */
-class Language extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
+class Language extends AbstractEntity
 {
     /**
      * @var string
index d5076a9..4d9d44e 100644 (file)
@@ -15,6 +15,9 @@ namespace TYPO3\CMS\Lang\Domain\Repository;
  */
 
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
+use TYPO3\CMS\Extensionmanager\Utility\ListUtility;
+use TYPO3\CMS\Lang\Domain\Model\Extension;
 
 /**
  * Extension repository
@@ -39,7 +42,7 @@ class ExtensionRepository
     /**
      * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
      */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
+    public function injectObjectManager(ObjectManagerInterface $objectManager)
     {
         $this->objectManager = $objectManager;
     }
@@ -47,7 +50,7 @@ class ExtensionRepository
     /**
      * @param \TYPO3\CMS\Extensionmanager\Utility\ListUtility $listUtility
      */
-    public function injectListUtility(\TYPO3\CMS\Extensionmanager\Utility\ListUtility $listUtility)
+    public function injectListUtility(ListUtility $listUtility)
     {
         $this->listUtility = $listUtility;
     }
@@ -64,7 +67,7 @@ class ExtensionRepository
             foreach ($extensions as $entry) {
                 /** @var $extension \TYPO3\CMS\Lang\Domain\Model\Extension */
                 $extension = $this->objectManager->get(
-                    \TYPO3\CMS\Lang\Domain\Model\Extension::class,
+                    Extension::class,
                     $entry['key'],
                     $entry['title'],
                     $this->getExtensionIconWithPath($entry)
@@ -99,7 +102,7 @@ class ExtensionRepository
      * Find one extension by offset
      *
      * @param int $offset The offset
-     * @return TYPO3\CMS\Lang\Domain\Model\Extension The extension
+     * @return \TYPO3\CMS\Lang\Domain\Model\Extension The extension
      */
     public function findOneByOffset($offset)
     {
index 2beaf06..281e24e 100644 (file)
@@ -14,7 +14,12 @@ namespace TYPO3\CMS\Lang\Domain\Repository;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Configuration\ConfigurationManager;
+use TYPO3\CMS\Core\Localization\Locales;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
+use TYPO3\CMS\Lang\Domain\Model\Language;
+use TYPO3\CMS\Lang\Service\RegistryService;
 
 /**
  * Language repository
@@ -54,7 +59,7 @@ class LanguageRepository
     /**
      * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
      */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
+    public function injectObjectManager(ObjectManagerInterface $objectManager)
     {
         $this->objectManager = $objectManager;
     }
@@ -62,7 +67,7 @@ class LanguageRepository
     /**
      * @param \TYPO3\CMS\Core\Localization\Locales $locales
      */
-    public function injectLocales(\TYPO3\CMS\Core\Localization\Locales $locales)
+    public function injectLocales(Locales $locales)
     {
         $this->locales = $locales;
     }
@@ -70,7 +75,7 @@ class LanguageRepository
     /**
      * @param \TYPO3\CMS\Lang\Service\RegistryService $registryService
      */
-    public function injectRegistryService(\TYPO3\CMS\Lang\Service\RegistryService $registryService)
+    public function injectRegistryService(RegistryService $registryService)
     {
         $this->registryService = $registryService;
     }
@@ -80,7 +85,7 @@ class LanguageRepository
      */
     public function __construct()
     {
-        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
         try {
             $globalSettings = $configurationManager->getLocalConfigurationValueByPath($this->configurationPath);
             $this->selectedLocales = (array)$globalSettings['availableLanguages'];
@@ -103,12 +108,12 @@ class LanguageRepository
             $languages = $this->locales->getLanguages();
             array_shift($languages);
             foreach ($languages as $locale => $language) {
-                $label = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:setup/Resources/Private/Language/locallang.xlf:lang_' . $locale));
+                $label = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:setup/Resources/Private/Language/locallang.xlf:lang_' . $locale));
                 if ($label === '') {
                     $label = htmlspecialchars($language);
                 }
                 $this->languages[$locale] = $this->objectManager->get(
-                    \TYPO3\CMS\Lang\Domain\Model\Language::class,
+                    Language::class,
                     $locale,
                     $label,
                     in_array($locale, $this->selectedLocales),
@@ -162,7 +167,7 @@ class LanguageRepository
         }
         $dir = count($languages) - count($this->selectedLocales);
         $diff = $dir < 0 ? array_diff($this->selectedLocales, $languages) : array_diff($languages, $this->selectedLocales);
-        GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class)->setLocalConfigurationValueByPath(
+        GeneralUtility::makeInstance(ConfigurationManager::class)->setLocalConfigurationValueByPath(
             $this->configurationPath,
             array('availableLanguages' => $languages)
         );
@@ -209,4 +214,14 @@ class LanguageRepository
         }
         return $this->updateSelectedLanguages($locales);
     }
+
+    /**
+     * Returns LanguageService
+     *
+     * @return \TYPO3\CMS\Lang\LanguageService
+     */
+    protected function getLanguageService()
+    {
+        return $GLOBALS['LANG'];
+    }
 }
index b25b3f4..a1ce077 100755 (executable)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Lang;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Charset\CharsetConverter;
+use TYPO3\CMS\Core\Localization\Locales;
 use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -106,13 +108,13 @@ class LanguageService
     public function init($lang)
     {
         // Initialize the conversion object:
-        $this->csConvObj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Charset\CharsetConverter::class);
+        $this->csConvObj = GeneralUtility::makeInstance(CharsetConverter::class);
         // Initialize the parser factory object
         $this->parserFactory = GeneralUtility::makeInstance(LocalizationFactory::class);
         // Find the requested language in this list based
         // on the $lang key being inputted to this function.
         /** @var $locales \TYPO3\CMS\Core\Localization\Locales */
-        $locales = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\Locales::class);
+        $locales = GeneralUtility::makeInstance(Locales::class);
         // Language is found. Configure it:
         if (in_array($lang, $locales->getLocales())) {
             // The current language key
index 701690f..242fba7 100755 (executable)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Lang\Service;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Registry;
+
 /**
  * Registry service
  */
@@ -32,7 +34,7 @@ class RegistryService
     /**
      * @param \TYPO3\CMS\Core\Registry $registry
      */
-    public function injectRegistry(\TYPO3\CMS\Core\Registry $registry)
+    public function injectRegistry(Registry $registry)
     {
         $this->registry = $registry;
     }
index 17dfcfa..6d1aca6 100644 (file)
@@ -14,14 +14,19 @@ namespace TYPO3\CMS\Lang\Service;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Exception;
+use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility;
+use TYPO3\CMS\Lang\Exception\Language as LanguageException;
+use TYPO3\CMS\Lang\Exception\XmlParser as XmlParserException;
 
 /**
  * Extends of extensionmanager ter connection to enrich with translation
  * related methods
  */
-class TerService extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility implements \TYPO3\CMS\Core\SingletonInterface
+class TerService extends TerUtility implements SingletonInterface
 {
     /**
      * Fetches extensions translation status
@@ -65,7 +70,7 @@ class TerService extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtili
             $line = xml_get_current_line_number($parser);
             $error = xml_error_string(xml_get_error_code($parser));
             xml_parser_free($parser);
-            throw new \TYPO3\CMS\Lang\Exception\XmlParser('Error in XML parser while decoding l10n XML file. Line ' . $line . ': ' . $error, 1345736517);
+            throw new XmlParserException('Error in XML parser while decoding l10n XML file. Line ' . $line . ': ' . $error, 1345736517);
         } else {
             // Init vars
             $stack = array(array());
@@ -76,7 +81,7 @@ class TerService extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtili
                 // Traverse the parsed XML structure:
             foreach ($values as $val) {
                 // First, process the tag-name (which is used in both cases, whether "complete" or "close")
-                $tagName = ($val['tag'] == 'languagepack' && $val['type'] == 'open') ? $val['attributes']['language'] : $val['tag'];
+                $tagName = (string)($val['tag'] == 'languagepack' && $val['type'] == 'open') ? $val['attributes']['language'] : $val['tag'];
                 if (!$documentTag) {
                     $documentTag = $tagName;
                 }
@@ -132,7 +137,7 @@ class TerService extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtili
                 $absoluteLanguagePath = GeneralUtility::getFileAbsFileName(PATH_typo3conf . $relativeLanguagePath);
                 $absoluteExtensionLanguagePath = GeneralUtility::getFileAbsFileName(PATH_typo3conf . $relativeLanguagePath . $extensionKey . '/');
                 if (empty($absolutePathToZipFile) || empty($absoluteLanguagePath) || empty($absoluteExtensionLanguagePath)) {
-                    throw new \TYPO3\CMS\Lang\Exception\Language('Given path is invalid.', 1352565336);
+                    throw new LanguageException('Given path is invalid.', 1352565336);
                 }
                 if (!is_dir($absoluteLanguagePath)) {
                     GeneralUtility::mkdir_deep(PATH_typo3conf, $relativeLanguagePath);
@@ -145,7 +150,7 @@ class TerService extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtili
                     $result = true;
                 }
             }
-        } catch (\TYPO3\CMS\Core\Exception $exception) {
+        } catch (Exception $exception) {
             // @todo logging
         }
         return $result;
@@ -184,7 +189,7 @@ class TerService extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtili
 
         $l10nResponse = GeneralUtility::getURL($mirrorUrl . $packageUrl, 0, array(TYPO3_user_agent));
         if ($l10nResponse === false) {
-            throw new \TYPO3\CMS\Lang\Exception\XmlParser('Error: Translation could not be fetched.', 1345736785);
+            throw new XmlParserException('Error: Translation could not be fetched.', 1345736785);
         } else {
             return array($l10nResponse);
         }
@@ -221,18 +226,18 @@ class TerService extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtili
                                 $absoluteTargetPath, zip_entry_read($zipEntry, zip_entry_filesize($zipEntry))
                             );
                             if ($return === false) {
-                                throw new \TYPO3\CMS\Lang\Exception\Language('Could not write file ' . $zipEntryName, 1345304560);
+                                throw new LanguageException('Could not write file ' . $zipEntryName, 1345304560);
                             }
                         } else {
-                            throw new \TYPO3\CMS\Lang\Exception\Language('Could not write file ' . $zipEntryName, 1352566904);
+                            throw new LanguageException('Could not write file ' . $zipEntryName, 1352566904);
                         }
                     }
                 } else {
-                    throw new \TYPO3\CMS\Lang\Exception\Language('Extension directory missing in zip file!', 1352566905);
+                    throw new LanguageException('Extension directory missing in zip file!', 1352566905);
                 }
             }
         } else {
-            throw new \TYPO3\CMS\Lang\Exception\Language('Unable to open zip file ' . $file, 1345304561);
+            throw new LanguageException('Unable to open zip file ' . $file, 1345304561);
         }
         return $result;
     }
index 126a66e..325bd14 100644 (file)
@@ -14,10 +14,15 @@ namespace TYPO3\CMS\Lang\Service;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\SingletonInterface;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
+use TYPO3\CMS\Extensionmanager\Utility\Repository\Helper;
+
 /**
  * Translation service
  */
-class TranslationService implements \TYPO3\CMS\Core\SingletonInterface
+class TranslationService implements SingletonInterface
 {
     /**
      * Status codes for AJAX response
@@ -47,7 +52,7 @@ class TranslationService implements \TYPO3\CMS\Core\SingletonInterface
     /**
      * @param \TYPO3\CMS\Lang\Service\TerService $terService
      */
-    public function injectTerService(\TYPO3\CMS\Lang\Service\TerService $terService)
+    public function injectTerService(TerService $terService)
     {
         $this->terService = $terService;
     }
@@ -55,7 +60,7 @@ class TranslationService implements \TYPO3\CMS\Core\SingletonInterface
     /**
      * @param \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher
      */
-    public function injectSignalSlotDispatcher(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher)
+    public function injectSignalSlotDispatcher(Dispatcher $signalSlotDispatcher)
     {
         $this->signalSlotDispatcher = $signalSlotDispatcher;
     }
@@ -63,7 +68,7 @@ class TranslationService implements \TYPO3\CMS\Core\SingletonInterface
     /**
      * @param \TYPO3\CMS\Extensionmanager\Utility\Repository\Helper $helper The helper
      */
-    public function injectRepositoryHelper(\TYPO3\CMS\Extensionmanager\Utility\Repository\Helper $helper)
+    public function injectRepositoryHelper(Helper $helper)
     {
         $this->mirrorUrl = $helper->getMirrors(false)->getMirrorUrl();
     }
@@ -78,11 +83,12 @@ class TranslationService implements \TYPO3\CMS\Core\SingletonInterface
     public function updateTranslation($extensionKey, $locales)
     {
         if (is_string($locales)) {
-            $locales = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $locales);
+            $locales = GeneralUtility::trimExplode(',', $locales);
         }
         $locales = array_flip((array) $locales);
         foreach ($locales as $locale => $key) {
             $state = static::TRANSLATION_INVALID;
+            $error = '';
             try {
                 $state = $this->updateTranslationForExtension($extensionKey, $locale);
             } catch (\Exception $exception) {
index 3b58b33..68946d2 100644 (file)
@@ -14,10 +14,14 @@ namespace TYPO3\CMS\Lang\View;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extbase\Mvc\View\AbstractView;
+use TYPO3\CMS\Extbase\Mvc\Web\Response;
+use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
+
 /**
  * Base class for JSON views
  */
-abstract class AbstractJsonView extends \TYPO3\CMS\Extbase\Mvc\View\AbstractView
+abstract class AbstractJsonView extends AbstractView
 {
     /**
      * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
@@ -27,7 +31,7 @@ abstract class AbstractJsonView extends \TYPO3\CMS\Extbase\Mvc\View\AbstractView
     /**
      * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
      */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
+    public function injectObjectManager(ObjectManagerInterface $objectManager)
     {
         $this->objectManager = $objectManager;
     }
@@ -58,7 +62,7 @@ abstract class AbstractJsonView extends \TYPO3\CMS\Extbase\Mvc\View\AbstractView
      */
     protected function sendResponse(array $data)
     {
-        $response = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Response::class);
+        $response = $this->objectManager->get(Response::class);
         $response->setHeader('Content-Type', 'application/json; charset=utf-8');
         $response->setContent(json_encode($data));
         $response->sendHeaders();
index a031e10..d88bd60 100644 (file)
@@ -29,12 +29,14 @@ class GetTranslationsJson extends \TYPO3\CMS\Lang\View\AbstractJsonView
         $data = array();
         $languages = $this->variables['languages'];
         foreach ($this->variables['extensions'] as $extension) {
+            /** @var $extension \TYPO3\CMS\Lang\Domain\Model\Extension */
             $extensionArray = $extension->toArray();
             $row = array(
                 $extensionArray,
                 $extensionArray,
             );
             foreach ($languages as $language) {
+                /** @var $language \TYPO3\CMS\Lang\Domain\Model\Language */
                 $row[] = $language->toArray();
             }
             $data[] = $row;