diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fb0352..65ef9af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: composer require typo3/cms-core:${{ matrix.typo3 }} --no-progress --no-update composer require typo3/cms-backend:${{ matrix.typo3 }} --no-progress --no-update composer require typo3/cms-extbase:${{ matrix.typo3 }} --no-progress --no-update - composer require typo3/cms-extensionmanager:${{ matrix.typo3 }} --no-progress --no-update + composer require typo3/cms-fluid:${{ matrix.typo3 }} --no-progress --no-update composer require ssch/typo3-rector:${{ matrix.rector }} --no-progress git checkout composer.json diff --git a/Classes/Configuration.php b/Classes/Configuration.php index a927c8f..9309a42 100644 --- a/Classes/Configuration.php +++ b/Classes/Configuration.php @@ -1,6 +1,5 @@ moduleTemplateFactory = $moduleTemplateFactory; - $this->universalMessengerService = $universalMessengerService; + $this->moduleTemplateFactory = $moduleTemplateFactory; + $this->universalMessengerService = $universalMessengerService; $this->newsletterChannelRepository = $newsletterChannelRepository; - $this->newsletterRenderService = $newsletterRenderService; + $this->newsletterRenderService = $newsletterRenderService; } /** diff --git a/Classes/Controller/NewsletterPreviewController.php b/Classes/Controller/NewsletterPreviewController.php index ecfe25b..4314553 100644 --- a/Classes/Controller/NewsletterPreviewController.php +++ b/Classes/Controller/NewsletterPreviewController.php @@ -29,7 +29,7 @@ class NewsletterPreviewController extends ActionController /** * @var NewsletterRenderService */ - private NewsletterRenderService $newsletterRenderService; + private readonly NewsletterRenderService $newsletterRenderService; /** * NewsletterPreviewController constructor. @@ -49,9 +49,9 @@ public function __construct( */ public function initializePreviewAction(): void { -// if ($this->getBackendUserAuthentication() === null) { -// throw new AccessDeniedException('Backend user authentication is missing.'); -// } + // if ($this->getBackendUserAuthentication() === null) { + // throw new AccessDeniedException('Backend user authentication is missing.'); + // } } /** diff --git a/Classes/Controller/UniversalMessengerController.php b/Classes/Controller/UniversalMessengerController.php index c66fbcb..e3f890f 100644 --- a/Classes/Controller/UniversalMessengerController.php +++ b/Classes/Controller/UniversalMessengerController.php @@ -18,6 +18,7 @@ use Netresearch\NrcUniversalMessenger\Service\UniversalMessengerService; use Netresearch\Sdk\UniversalMessenger\RequestBuilder\EventFile\CreateRequestBuilder; use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\UriInterface; use TYPO3\CMS\Backend\Routing\PreviewUriBuilder; use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; use TYPO3\CMS\Backend\Utility\BackendUtility; @@ -38,7 +39,7 @@ class UniversalMessengerController extends AbstractBaseController /** * @var SiteFinder */ - private SiteFinder $siteFinder; + private readonly SiteFinder $siteFinder; /** * UniversalMessengerController constructor. @@ -97,7 +98,7 @@ public function indexAction(): ResponseInterface $previewUri = PreviewUriBuilder::create($this->pageId) ->withAdditionalQueryParameters([ - 'type' => self::PREVIEW_TYPE_NUMBER, + 'type' => self::PREVIEW_TYPE_NUMBER, 'tx_nrcuniversalmessenger_newsletterpreview' => [ 'pageId' => $this->pageId, ], @@ -107,7 +108,7 @@ public function indexAction(): ResponseInterface $previewUrl = (string) $previewUri; - if (($previewUri === null) || ($previewUrl === '')) { + if ((!$previewUri instanceof UriInterface) || ($previewUrl === '')) { return $this->forwardFlashMessage('error.noSiteConfiguration'); } @@ -131,8 +132,8 @@ public function indexAction(): ResponseInterface */ public function createAction(?NewsletterChannel $newsletterChannel): ResponseInterface { -DebuggerUtility::var_dump(__METHOD__); -//DebuggerUtility::var_dump($newsletterChannel); + DebuggerUtility::var_dump(__METHOD__); + // DebuggerUtility::var_dump($newsletterChannel); if (!($newsletterChannel instanceof NewsletterChannel) || !$this->request->hasArgument('send') @@ -146,20 +147,20 @@ public function createAction(?NewsletterChannel $newsletterChannel): ResponseInt $newsletterChannelId = $newsletterChannel->getChannelId(); $newsletterContent = $this->newsletterRenderService->renderNewsletterPage($this->pageId); -// // Embed all images -// if ($newsletterChannel->getEmbedImages() === 'all') { -// $newsletterContent = $this->convertImagesToDataUri( -// $newsletterContent, -// (string) $site->getBase() -// ); -// } + // // Embed all images + // if ($newsletterChannel->getEmbedImages() === 'all') { + // $newsletterContent = $this->convertImagesToDataUri( + // $newsletterContent, + // (string) $site->getBase() + // ); + // } if ($newsletterType === 'TEST') { $newsletterChannelId .= '_Test'; } else { $newsletterChannelId .= '_Live'; -DebuggerUtility::var_dump('LIVE'); -exit; + DebuggerUtility::var_dump('LIVE'); + exit; } /** @var CreateRequestBuilder $createRequestBuilder */ @@ -190,15 +191,15 @@ public function createAction(?NewsletterChannel $newsletterChannel): ResponseInt ->addTag($newsletterType) ->create(); -DebuggerUtility::var_dump($eventRequest); -//exit; + DebuggerUtility::var_dump($eventRequest); + // exit; $result = $this->universalMessengerService ->api() ->eventFile() ->event($eventRequest); -DebuggerUtility::var_dump($result); + DebuggerUtility::var_dump($result); return $this->moduleTemplate->renderResponse('Backend/UniversalMessenger'); } diff --git a/Classes/Domain/Model/NewsletterChannel.php b/Classes/Domain/Model/NewsletterChannel.php index 1d4ecec..a34d398 100644 --- a/Classes/Domain/Model/NewsletterChannel.php +++ b/Classes/Domain/Model/NewsletterChannel.php @@ -149,6 +149,7 @@ public function getChannelId(): string public function setChannelId(string $channelId): NewsletterChannel { $this->channelId = $channelId; + return $this; } @@ -188,6 +189,7 @@ public function getDescription(): string public function setDescription(string $description): NewsletterChannel { $this->description = $description; + return $this; } diff --git a/Classes/EventListener/ModifyPageLayoutContentEventListener.php b/Classes/EventListener/ModifyPageLayoutContentEventListener.php index ddf333b..349abf2 100644 --- a/Classes/EventListener/ModifyPageLayoutContentEventListener.php +++ b/Classes/EventListener/ModifyPageLayoutContentEventListener.php @@ -22,7 +22,6 @@ use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Utility\DebuggerUtility; /** * Event listener to add a link button to the Universal Messenger module to the default button bar. @@ -42,7 +41,7 @@ public function __invoke(ModifyPageLayoutContentEvent $event): void { $view = $event->getModuleTemplate(); $buttonBar = $view->getDocHeaderComponent()->getButtonBar(); - $pageId = $this->getPageId($event->getRequest()); + $pageId = $this->getPageId($event->getRequest()); $contentPage = BackendUtility::getRecord('pages', $pageId); // Show button only at pages matching our page type. diff --git a/Classes/Service/NewsletterRenderService.php b/Classes/Service/NewsletterRenderService.php index 36099fe..ff046c7 100644 --- a/Classes/Service/NewsletterRenderService.php +++ b/Classes/Service/NewsletterRenderService.php @@ -42,17 +42,17 @@ class NewsletterRenderService implements SingletonInterface /** * @var ConfigurationManagerInterface */ - private ConfigurationManagerInterface $configurationManager; + private readonly ConfigurationManagerInterface $configurationManager; /** * @var RequestFactory */ - private RequestFactory $requestFactory; + private readonly RequestFactory $requestFactory; /** * @var SiteFinder */ - private SiteFinder $siteFinder; + private readonly SiteFinder $siteFinder; /** * Constructor. @@ -67,8 +67,8 @@ public function __construct( SiteFinder $siteFinder ) { $this->configurationManager = $configurationManager; - $this->requestFactory = $requestFactory; - $this->siteFinder = $siteFinder; + $this->requestFactory = $requestFactory; + $this->siteFinder = $siteFinder; } /** @@ -122,7 +122,7 @@ private function getSiteByPageId(int $pageId): Site } /** - * @param int $pageId + * @param int $pageId * * @return string * diff --git a/Classes/WebserviceConfiguration.php b/Classes/WebserviceConfiguration.php index 46401f3..87f2cde 100644 --- a/Classes/WebserviceConfiguration.php +++ b/Classes/WebserviceConfiguration.php @@ -29,14 +29,14 @@ class WebserviceConfiguration * * @var string */ - private string $apiBaseUrl; + private readonly string $apiBaseUrl; /** * The API key. * * @var string */ - private string $apiKey; + private readonly string $apiKey; /** * WebserviceConfiguration constructor. diff --git a/Configuration/Backend/Modules.php b/Configuration/Backend/Modules.php index e560ec9..ea33500 100644 --- a/Configuration/Backend/Modules.php +++ b/Configuration/Backend/Modules.php @@ -8,8 +8,6 @@ */ declare(strict_types=1); - -use Netresearch\NrcUniversalMessenger\Controller\NewsletterPreviewController; use Netresearch\NrcUniversalMessenger\Controller\UniversalMessengerController; // Caution, variable name must not exist within \TYPO3\CMS\Core\Package\AbstractServiceProvider::configureBackendModules diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php index cb0793c..60318ef 100644 --- a/Configuration/TCA/Overrides/pages.php +++ b/Configuration/TCA/Overrides/pages.php @@ -33,7 +33,7 @@ $GLOBALS['TCA']['pages'], [ // Add the icon to the icon class configuration - 'ctrl' => [ + 'ctrl' => [ 'typeicon_classes' => [ $newsletterDokType => 'universal-messenger-dok-type-newsletter', ], diff --git a/Configuration/TCA/tx_nrcuniversalmessenger_domain_model_newsletterchannel.php b/Configuration/TCA/tx_nrcuniversalmessenger_domain_model_newsletterchannel.php index 590d21e..8148039 100644 --- a/Configuration/TCA/tx_nrcuniversalmessenger_domain_model_newsletterchannel.php +++ b/Configuration/TCA/tx_nrcuniversalmessenger_domain_model_newsletterchannel.php @@ -12,7 +12,7 @@ // Do not add "delete => 'deleted'" into the 'ctrl' section to achieve direct removal of records // upon removeAll call in persistence manager. return [ - 'ctrl' => [ + 'ctrl' => [ 'title' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel', 'label' => 'title', 'tstamp' => 'tstamp', @@ -25,31 +25,31 @@ 'interface' => [ 'maxSingleDBListItems' => 50, ], - 'types' => [ + 'types' => [ 0 => [ 'showitem' => 'channel_id, title, description, sender, reply_to, skip_used_id, embed_images', ], ], - 'columns' => [ - 'pid' => [ + 'columns' => [ + 'pid' => [ 'label' => 'pid', 'config' => [ 'type' => 'passthrough', ], ], - 'crdate' => [ + 'crdate' => [ 'label' => 'crdate', 'config' => [ 'type' => 'datetime', ], ], - 'tstamp' => [ + 'tstamp' => [ 'label' => 'tstamp', 'config' => [ 'type' => 'datetime', ], ], - 'starttime' => [ + 'starttime' => [ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', 'config' => [ @@ -60,13 +60,13 @@ ], ], ], - 'endtime' => [ + 'endtime' => [ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', 'config' => [ - 'type' => 'datetime', - 'default' => 0, - 'range' => [ + 'type' => 'datetime', + 'default' => 0, + 'range' => [ 'upper' => mktime( 0, 0, @@ -93,7 +93,7 @@ 'required' => true, ], ], - 'title' => [ + 'title' => [ 'exclude' => true, 'label' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel.title', 'description' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel.title.description', @@ -105,7 +105,7 @@ 'required' => true, ], ], - 'description' => [ + 'description' => [ 'exclude' => true, 'label' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel.description', 'config' => [ @@ -115,7 +115,7 @@ 'readOnly' => true, ], ], - 'sender' => [ + 'sender' => [ 'exclude' => true, 'label' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel.sender', 'description' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel.sender.description', @@ -125,7 +125,7 @@ 'eval' => 'trim', ], ], - 'reply_to' => [ + 'reply_to' => [ 'exclude' => true, 'label' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel.reply_to', 'description' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel.reply_to.description', @@ -135,7 +135,7 @@ 'eval' => 'trim', ], ], - 'skip_used_id' => [ + 'skip_used_id' => [ 'exclude' => true, 'label' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel.skip_used_id', 'description' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel.skip_used_id.description', @@ -145,7 +145,7 @@ 'default' => 0, ], ], - 'embed_images' => [ + 'embed_images' => [ 'exclude' => true, 'label' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel.embed_images', 'description' => 'LLL:EXT:nrc_universal_messenger/Resources/Private/Language/locallang.xlf:tx_nrcuniversalmessenger_domain_model_newsletterchannel.embed_images.description', diff --git a/composer.json b/composer.json index 672ddcc..178eeb6 100644 --- a/composer.json +++ b/composer.json @@ -26,16 +26,16 @@ "typo3/cms-extbase": "^12.4", "typo3/cms-fluid": "^12.4", "nyholm/psr7": "^1.8", - "pelago/emogrifier": "^7.2.0", + "pelago/emogrifier": "^7.2", "netresearch/sdk-api-universal-messenger": "*" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.50", "friendsoftypo3/phpstan-typo3": "^0.9", "overtrue/phplint": "^9.3", - "phpstan/phpstan": "^1.11", - "phpstan/phpstan-strict-rules": "^1.6", - "phpstan/phpstan-deprecation-rules": "^1.2", + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-strict-rules": "^1.0", + "phpstan/phpstan-deprecation-rules": "^1.0", "ssch/typo3-rector": "^2.6" }, "config": {