Skip to content
Snippets Groups Projects
Commit b8c56208 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Code cleanups

parent 34f2f125
No related branches found
No related tags found
No related merge requests found
...@@ -48,5 +48,3 @@ interface RegisterInterface { ...@@ -48,5 +48,3 @@ interface RegisterInterface {
*/ */
public function registerTemplate(); public function registerTemplate();
} }
?>
\ No newline at end of file
...@@ -39,10 +39,10 @@ use TYPO3\CMS\Extbase\Object\ObjectManager; ...@@ -39,10 +39,10 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
* Provides an api for registering your mail templates * Provides an api for registering your mail templates
*/ */
class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
const CACHE_NAME = 'sg_mail_registerArrayCache'; public const CACHE_NAME = 'sg_mail_registerArrayCache';
const CACHE_LIFETIME_IN_SECONDS = 86400; public const CACHE_LIFETIME_IN_SECONDS = 86400;
const DEFAULT_TEMPLATE_PATH = 'Resources/Private/Templates/SgMail/'; public const DEFAULT_TEMPLATE_PATH = 'Resources/Private/Templates/SgMail/';
const CONFIG_PATH = 'Configuration/MailTemplates/Forms'; public const CONFIG_PATH = 'Configuration/MailTemplates/Forms';
/** /**
* contains the actual registration data * contains the actual registration data
...@@ -141,7 +141,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { ...@@ -141,7 +141,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
continue; continue;
} }
$this->writeRegisterArrayEntry($extensionKey, $templateKey, $configArray, FALSE); $this->writeRegisterArrayEntry($extensionKey, $templateKey, $configArray);
} }
} }
...@@ -157,7 +157,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { ...@@ -157,7 +157,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
*/ */
private function writeRegisterArrayEntry( private function writeRegisterArrayEntry(
$extensionKey, $templateKey, array $configArray $extensionKey, $templateKey, array $configArray
) { ): void {
// template_path means where to find the mail body content (usually it's set directly in the registration // template_path means where to find the mail body content (usually it's set directly in the registration
// as template_content) // as template_content)
$templatePath = ''; $templatePath = '';
...@@ -213,7 +213,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { ...@@ -213,7 +213,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
* *
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
*/ */
public function clearCaches() { public function clearCaches(): void {
$objectManager = GeneralUtility::makeInstance(ObjectManager::class); $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$cacheManager = $objectManager->get(CacheManager::class); $cacheManager = $objectManager->get(CacheManager::class);
...@@ -291,7 +291,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { ...@@ -291,7 +291,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
* @param string $markerName * @param string $markerName
* @return string * @return string
*/ */
public static function normalizeFormFieldMarkerName($markerName = '') { public static function normalizeFormFieldMarkerName($markerName = ''): string {
return \preg_replace('/[^a-z0-9\-_]/i', '', $markerName); return \preg_replace('/[^a-z0-9\-_]/i', '', $markerName);
} }
...@@ -299,7 +299,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { ...@@ -299,7 +299,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
* Register the caches for the RegisterService * Register the caches for the RegisterService
* This method is for usage in ext_localconf.php to register the cache configuration * This method is for usage in ext_localconf.php to register the cache configuration
*/ */
public function registerCache() { public function registerCache(): void {
$cacheConfigurations = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']; $cacheConfigurations = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'];
if (!isset($cacheConfigurations[self::CACHE_NAME])) { if (!isset($cacheConfigurations[self::CACHE_NAME])) {
$cacheConfigurations[self::CACHE_NAME] = [ $cacheConfigurations[self::CACHE_NAME] = [
......
...@@ -49,7 +49,7 @@ class PhpSession implements SingletonInterface { ...@@ -49,7 +49,7 @@ class PhpSession implements SingletonInterface {
* @param string $sessionKey * @param string $sessionKey
* @return void * @return void
*/ */
public function setSessionKey($sessionKey) { public function setSessionKey($sessionKey): void {
$this->sessionKey = $sessionKey; $this->sessionKey = $sessionKey;
} }
...@@ -58,7 +58,7 @@ class PhpSession implements SingletonInterface { ...@@ -58,7 +58,7 @@ class PhpSession implements SingletonInterface {
* *
* @return string * @return string
*/ */
public function getSessionKey() { public function getSessionKey(): string {
return $this->sessionKey; return $this->sessionKey;
} }
...@@ -68,7 +68,7 @@ class PhpSession implements SingletonInterface { ...@@ -68,7 +68,7 @@ class PhpSession implements SingletonInterface {
* @param mixed $data * @param mixed $data
* @return void * @return void
*/ */
public function exchangeData($data) { public function exchangeData($data): void {
$this->destroy(); $this->destroy();
$_SESSION[$this->sessionKey] = $data; $_SESSION[$this->sessionKey] = $data;
} }
...@@ -89,7 +89,7 @@ class PhpSession implements SingletonInterface { ...@@ -89,7 +89,7 @@ class PhpSession implements SingletonInterface {
* @param mixed $data * @param mixed $data
* @return void * @return void
*/ */
public function setDataByKey($key, $data) { public function setDataByKey($key, $data): void {
$_SESSION[$this->sessionKey][$key] = $data; $_SESSION[$this->sessionKey][$key] = $data;
} }
...@@ -109,7 +109,7 @@ class PhpSession implements SingletonInterface { ...@@ -109,7 +109,7 @@ class PhpSession implements SingletonInterface {
* @param string $key * @param string $key
* @return void * @return void
*/ */
public function unsetDataByKey($key) { public function unsetDataByKey($key): void {
unset($_SESSION[$this->sessionKey][$key]); unset($_SESSION[$this->sessionKey][$key]);
} }
...@@ -118,7 +118,7 @@ class PhpSession implements SingletonInterface { ...@@ -118,7 +118,7 @@ class PhpSession implements SingletonInterface {
* *
* @return void * @return void
*/ */
public function destroy() { public function destroy(): void {
unset($_SESSION[$this->sessionKey]); unset($_SESSION[$this->sessionKey]);
} }
} }
...@@ -27,7 +27,6 @@ namespace SGalinski\SgMail\UserFunc; ...@@ -27,7 +27,6 @@ namespace SGalinski\SgMail\UserFunc;
***************************************************************/ ***************************************************************/
use SGalinski\SgMail\Service\RegisterService; use SGalinski\SgMail\Service\RegisterService;
use TYPO3\CMS\Core\Configuration\ConfigurationManager;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment