Skip to content

Commit

Permalink
Apply rector/php-cs-fixer rules
Browse files Browse the repository at this point in the history
  • Loading branch information
magicsunday committed May 28, 2024
1 parent 57ab4d0 commit 1b25248
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Classes/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php


/**
* This file is part of the package netresearch/nrc-universal-messenger.
*
Expand Down
8 changes: 4 additions & 4 deletions Classes/Controller/AbstractBaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ abstract class AbstractBaseController extends ActionController
/**
* @var ModuleTemplateFactory
*/
private ModuleTemplateFactory $moduleTemplateFactory;
private readonly ModuleTemplateFactory $moduleTemplateFactory;

/**
* @var ModuleTemplate
Expand Down Expand Up @@ -85,10 +85,10 @@ public function __construct(
NewsletterChannelRepository $newsletterChannelRepository,
NewsletterRenderService $newsletterRenderService
) {
$this->moduleTemplateFactory = $moduleTemplateFactory;
$this->universalMessengerService = $universalMessengerService;
$this->moduleTemplateFactory = $moduleTemplateFactory;
$this->universalMessengerService = $universalMessengerService;
$this->newsletterChannelRepository = $newsletterChannelRepository;
$this->newsletterRenderService = $newsletterRenderService;
$this->newsletterRenderService = $newsletterRenderService;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions Classes/Controller/NewsletterPreviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class NewsletterPreviewController extends ActionController
/**
* @var NewsletterRenderService
*/
private NewsletterRenderService $newsletterRenderService;
private readonly NewsletterRenderService $newsletterRenderService;

/**
* NewsletterPreviewController constructor.
Expand All @@ -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.');
// }
}

/**
Expand Down
35 changes: 18 additions & 17 deletions Classes/Controller/UniversalMessengerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,7 +39,7 @@ class UniversalMessengerController extends AbstractBaseController
/**
* @var SiteFinder
*/
private SiteFinder $siteFinder;
private readonly SiteFinder $siteFinder;

/**
* UniversalMessengerController constructor.
Expand Down Expand Up @@ -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,
],
Expand All @@ -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');
}

Expand All @@ -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')
Expand All @@ -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 */
Expand Down Expand Up @@ -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');
}
Expand Down
2 changes: 2 additions & 0 deletions Classes/Domain/Model/NewsletterChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public function getChannelId(): string
public function setChannelId(string $channelId): NewsletterChannel
{
$this->channelId = $channelId;

return $this;
}

Expand Down Expand Up @@ -188,6 +189,7 @@ public function getDescription(): string
public function setDescription(string $description): NewsletterChannel
{
$this->description = $description;

return $this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions Classes/Service/NewsletterRenderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -67,8 +67,8 @@ public function __construct(
SiteFinder $siteFinder
) {
$this->configurationManager = $configurationManager;
$this->requestFactory = $requestFactory;
$this->siteFinder = $siteFinder;
$this->requestFactory = $requestFactory;
$this->siteFinder = $siteFinder;
}

/**
Expand Down Expand Up @@ -122,7 +122,7 @@ private function getSiteByPageId(int $pageId): Site
}

/**
* @param int $pageId
* @param int $pageId
*
* @return string
*
Expand Down
4 changes: 2 additions & 2 deletions Classes/WebserviceConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions Configuration/Backend/Modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TCA/Overrides/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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' => [
Expand All @@ -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,
Expand All @@ -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',
Expand All @@ -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' => [
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down
Loading

0 comments on commit 1b25248

Please sign in to comment.