Commit 868bf0b8 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Fix all CGL violations in t3o_donation

parent fa02f051
Pipeline #5766 passed with stages
in 5 minutes and 46 seconds
...@@ -103,8 +103,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl ...@@ -103,8 +103,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
/** /**
* action list * action list
*
* @return void
*/ */
public function listAction() public function listAction()
{ {
...@@ -114,8 +112,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl ...@@ -114,8 +112,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
/** /**
* action form * action form
*
* @return void
*/ */
public function formAction() public function formAction()
{ {
...@@ -132,8 +128,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl ...@@ -132,8 +128,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
/** /**
* action thankyou * action thankyou
*
* @return void
*/ */
public function thankyouAction() public function thankyouAction()
{ {
...@@ -154,8 +148,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl ...@@ -154,8 +148,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
/** /**
* action ipn log * action ipn log
*
* @return void
*/ */
public function ipnLogAction() public function ipnLogAction()
{ {
...@@ -164,11 +156,11 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl ...@@ -164,11 +156,11 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
$verified = $this->ipnService->verify($parameters, $this->getConfigurationOption('paypal.action')); $verified = $this->ipnService->verify($parameters, $this->getConfigurationOption('paypal.action'));
if (!$verified) { if (!$verified) {
$this->addFlashMessage('Payment verification failed','Paypal transaction',\TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); $this->addFlashMessage('Payment verification failed', 'Paypal transaction', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
return; return;
} }
if (!$this->ipnService->isNewCompletedTransaction($parameters, $this->donationRepository)) { if (!$this->ipnService->isNewCompletedTransaction($parameters, $this->donationRepository)) {
$this->addFlashMessage('isNewCompletedTransaction == false','Paypal transaction',\TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); $this->addFlashMessage('isNewCompletedTransaction == false', 'Paypal transaction', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
return; return;
} }
$donation = $this->ipnService->createDonation($parameters); $donation = $this->ipnService->createDonation($parameters);
...@@ -186,16 +178,16 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl ...@@ -186,16 +178,16 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
protected function sendNotificationMail($donation) protected function sendNotificationMail($donation)
{ {
if (isset($this->settings['fromName']) && $this->settings['fromName'] !== '') { if (isset($this->settings['fromName']) && $this->settings['fromName'] !== '') {
$from = array($this->settings['fromAddress'] => $this->settings['fromName']); $from = [$this->settings['fromAddress'] => $this->settings['fromName']];
} else { } else {
$from = array($this->settings['fromAddress']); $from = [$this->settings['fromAddress']];
} }
if (isset($this->settings['replyToName']) && $this->settings['replyToName'] !== '') { if (isset($this->settings['replyToName']) && $this->settings['replyToName'] !== '') {
$replyTo = array($this->settings['replyToAddress'] => $this->settings['replyToName']); $replyTo = [$this->settings['replyToAddress'] => $this->settings['replyToName']];
} elseif (isset($this->settings['replyToAddress']) && $this->settings['replyToAddress'] !== '') { } elseif (isset($this->settings['replyToAddress']) && $this->settings['replyToAddress'] !== '') {
$replyTo = array($this->settings['replyToAddress']); $replyTo = [$this->settings['replyToAddress']];
} else { } else {
$replyTo = array(); $replyTo = [];
} }
return $this->mailService->sendDonationNotification( return $this->mailService->sendDonationNotification(
$donation, $donation,
...@@ -211,16 +203,16 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl ...@@ -211,16 +203,16 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
protected function sendThankyouMail($donation) protected function sendThankyouMail($donation)
{ {
if (isset($this->settings['fromName']) && $this->settings['fromName'] !== '') { if (isset($this->settings['fromName']) && $this->settings['fromName'] !== '') {
$from = array($this->settings['fromAddress'] => $this->settings['fromName']); $from = [$this->settings['fromAddress'] => $this->settings['fromName']];
} else { } else {
$from = array($this->settings['fromAddress']); $from = [$this->settings['fromAddress']];
} }
if (isset($this->settings['replyToName']) && $this->settings['replyToName'] !== '') { if (isset($this->settings['replyToName']) && $this->settings['replyToName'] !== '') {
$replyTo = array($this->settings['replyToAddress'] => $this->settings['replyToName']); $replyTo = [$this->settings['replyToAddress'] => $this->settings['replyToName']];
} elseif (isset($this->settings['replyToAddress']) && $this->settings['replyToAddress'] !== '') { } elseif (isset($this->settings['replyToAddress']) && $this->settings['replyToAddress'] !== '') {
$replyTo = array($this->settings['replyToAddress']); $replyTo = [$this->settings['replyToAddress']];
} else { } else {
$replyTo = array(); $replyTo = [];
} }
return $this->mailService->sendDonationThankyou( return $this->mailService->sendDonationThankyou(
$donation, $donation,
......
...@@ -427,7 +427,6 @@ class Donation extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -427,7 +427,6 @@ class Donation extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
return $this->date; return $this->date;
} }
/** /**
* @return \DateTime * @return \DateTime
*/ */
......
...@@ -20,5 +20,4 @@ namespace T3o\T3oDonation\Domain\Repository; ...@@ -20,5 +20,4 @@ namespace T3o\T3oDonation\Domain\Repository;
*/ */
class AccountRepository extends \TYPO3\CMS\Extbase\Persistence\Repository class AccountRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{ {
} }
...@@ -13,7 +13,6 @@ namespace T3o\T3oDonation\Domain\Repository; ...@@ -13,7 +13,6 @@ namespace T3o\T3oDonation\Domain\Repository;
* *
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
use TYPO3\CMS\Extbase\Persistence\QueryInterface; use TYPO3\CMS\Extbase\Persistence\QueryInterface;
/** /**
...@@ -22,8 +21,8 @@ use TYPO3\CMS\Extbase\Persistence\QueryInterface; ...@@ -22,8 +21,8 @@ use TYPO3\CMS\Extbase\Persistence\QueryInterface;
*/ */
class DonationRepository extends \TYPO3\CMS\Extbase\Persistence\Repository class DonationRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{ {
protected $defaultOrderings = array( protected $defaultOrderings = [
'crdate' => QueryInterface::ORDER_DESCENDING, 'crdate' => QueryInterface::ORDER_DESCENDING,
'date' => QueryInterface::ORDER_DESCENDING, 'date' => QueryInterface::ORDER_DESCENDING,
); ];
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace T3o\T3oDonation\Service; namespace T3o\T3oDonation\Service;
use T3o\T3oDonation\Domain\Model\Donation; use T3o\T3oDonation\Domain\Model\Donation;
use \TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
...@@ -45,9 +45,9 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface ...@@ -45,9 +45,9 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface
{ {
$extPath = ExtensionManagementUtility::extPath('t3o_donation'); $extPath = ExtensionManagementUtility::extPath('t3o_donation');
$oView = $this->objectManager->get('TYPO3\CMS\Fluid\View\StandaloneView'); $oView = $this->objectManager->get('TYPO3\CMS\Fluid\View\StandaloneView');
$oView->setTemplateRootPaths(array($extPath . 'Resources/Private/Templates/Mail')); $oView->setTemplateRootPaths([$extPath . 'Resources/Private/Templates/Mail']);
$oView->setPartialRootPaths(array($extPath . 'Resources/Private/Partials')); $oView->setPartialRootPaths([$extPath . 'Resources/Private/Partials']);
$oView->setLayoutRootPaths(array($extPath . 'Resources/Private/Layouts/')); $oView->setLayoutRootPaths([$extPath . 'Resources/Private/Layouts/']);
return $oView; return $oView;
} }
...@@ -59,7 +59,7 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface ...@@ -59,7 +59,7 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface
* @param array $replyTo * @param array $replyTo
* @return bool * @return bool
*/ */
public function sendDonationNotification(Donation $donation, $from, $replyTo = array()) public function sendDonationNotification(Donation $donation, $from, $replyTo = [])
{ {
$oView = $this->getMailView(); $oView = $this->getMailView();
$oView->setTemplate('Notification'); $oView->setTemplate('Notification');
...@@ -80,11 +80,11 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface ...@@ -80,11 +80,11 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface
$this->mailMessage->setSubject(LocalizationUtility::translate( $this->mailMessage->setSubject(LocalizationUtility::translate(
'mail_notification_subject', 'mail_notification_subject',
't3o_donation', 't3o_donation',
array($account->getName(), $siteUrl) [$account->getName(), $siteUrl]
)); ));
$this->mailMessage->setTo(array( $this->mailMessage->setTo([
$account->getEmailNotification() => $account->getName() $account->getEmailNotification() => $account->getName()
)); ]);
$this->mailMessage->setFrom($from); $this->mailMessage->setFrom($from);
if (!empty($replyTo)) { if (!empty($replyTo)) {
$this->mailMessage->setReplyTo($replyTo); $this->mailMessage->setReplyTo($replyTo);
...@@ -105,7 +105,7 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface ...@@ -105,7 +105,7 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface
* @param array $replyTo * @param array $replyTo
* @return bool * @return bool
*/ */
public function sendDonationThankyou(Donation $donation, $subject, $bodyText, $from, $replyTo = array()) public function sendDonationThankyou(Donation $donation, $subject, $bodyText, $from, $replyTo = [])
{ {
$oView = $this->getMailView(); $oView = $this->getMailView();
$oView->setTemplate('Thankyou'); $oView->setTemplate('Thankyou');
...@@ -125,9 +125,9 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface ...@@ -125,9 +125,9 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface
} }
$this->mailMessage->setBody($body, 'text/html'); $this->mailMessage->setBody($body, 'text/html');
$this->mailMessage->setSubject($subject); $this->mailMessage->setSubject($subject);
$this->mailMessage->setTo(array( $this->mailMessage->setTo([
$donation->getEmail() => $donation->getName() $donation->getEmail() => $donation->getName()
)); ]);
$this->mailMessage->setFrom($from); $this->mailMessage->setFrom($from);
if (!empty($replyTo)) { if (!empty($replyTo)) {
$this->mailMessage->setReplyTo($replyTo); $this->mailMessage->setReplyTo($replyTo);
......
...@@ -72,7 +72,7 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface ...@@ -72,7 +72,7 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface
$logger = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger(__CLASS__); $logger = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger(__CLASS__);
$logger->debug('Verifing PayPal IPN', $parameters); $logger->debug('Verifing PayPal IPN', $parameters);
$formData = array_merge($parameters, array('cmd' => '_notify-validate')); $formData = array_merge($parameters, ['cmd' => '_notify-validate']);
$additionalOptions = [ $additionalOptions = [
'form_params' => $formData, 'form_params' => $formData,
]; ];
...@@ -84,7 +84,7 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface ...@@ -84,7 +84,7 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface
if ($response->getStatusCode() !== 200) { if ($response->getStatusCode() !== 200) {
$logger->debug( $logger->debug(
'Wrong status code for IPN verification.', 'Wrong status code for IPN verification.',
array('HTTP status' => $response->getStatusCode()) ['HTTP status' => $response->getStatusCode()]
); );
return false; return false;
} }
...@@ -92,7 +92,7 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface ...@@ -92,7 +92,7 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface
$paypalResponse = $response->getBody()->getContents(); $paypalResponse = $response->getBody()->getContents();
$logger->debug( $logger->debug(
'Got response for IPN verification.', 'Got response for IPN verification.',
array('body' => $paypalResponse) ['body' => $paypalResponse]
); );
if ($paypalResponse !== 'VERIFIED') { if ($paypalResponse !== 'VERIFIED') {
...@@ -169,12 +169,12 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface ...@@ -169,12 +169,12 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface
return $donation; return $donation;
// url parse from memo? // url parse from memo?
} }
protected function findUrl($haystack = '') { protected function findUrl($haystack = '')
{
$url = ''; $url = '';
$matches = array(); $matches = [];
if (preg_match('/\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]/i', $haystack, $matches)) { if (preg_match('/\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]/i', $haystack, $matches)) {
$url = $matches[0]; $url = $matches[0];
......
<?php <?php
if (!defined('TYPO3_MODE')) { if (!defined('TYPO3_MODE')) {
die ('Access denied.'); die('Access denied.');
} }
return array( return [
'ctrl' => array( 'ctrl' => [
'title' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account', 'title' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account',
'label' => 'name', 'label' => 'name',
'tstamp' => 'tstamp', 'tstamp' => 'tstamp',
'crdate' => 'crdate', 'crdate' => 'crdate',
'cruser_id' => 'cruser_id', 'cruser_id' => 'cruser_id',
'default_sortby' => "ORDER BY name", 'default_sortby' => 'ORDER BY name',
'delete' => 'deleted', 'delete' => 'deleted',
'enablecolumns' => array( 'enablecolumns' => [
'disabled' => 'hidden', 'disabled' => 'hidden',
), ],
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3o_donation') . 'Configuration/TCA/tx_t3odonation_domain_model_account.php', 'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3o_donation') . 'Configuration/TCA/tx_t3odonation_domain_model_account.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3o_donation') . 'Resources/Public/Icons/tx_t3odonation_domain_model_account.gif', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3o_donation') . 'Resources/Public/Icons/tx_t3odonation_domain_model_account.gif',
'dividers2tabs' => true, 'dividers2tabs' => true,
), ],
'interface' => array( 'interface' => [
'showRecordFieldList' => 'hidden,name,email_notification,email_paypal' 'showRecordFieldList' => 'hidden,name,email_notification,email_paypal'
), ],
'columns' => array( 'columns' => [
'hidden' => array( 'hidden' => [
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden', 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array( 'config' => [
'type' => 'check', 'type' => 'check',
'default' => '0' 'default' => '0'
) ]
), ],
'name' => array( 'name' => [
'exclude' => 0, 'exclude' => 0,
'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.name', 'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.name',
'config' => array( 'config' => [
'type' => 'input', 'type' => 'input',
'size' => '30', 'size' => '30',
'eval' => 'required,trim', 'eval' => 'required,trim',
) ]
), ],
'email_notification' => array( 'email_notification' => [
'exclude' => 0, 'exclude' => 0,
'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.email_notification', 'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.email_notification',
'config' => array( 'config' => [
'type' => 'input', 'type' => 'input',
'size' => '30', 'size' => '30',
'eval' => 'trim', 'eval' => 'trim',
) ]
), ],
'email_paypal' => array( 'email_paypal' => [
'exclude' => 0, 'exclude' => 0,
'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.email_paypal', 'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.email_paypal',
'config' => array( 'config' => [
'type' => 'input', 'type' => 'input',
'size' => '30', 'size' => '30',
'eval' => 'trim', 'eval' => 'trim',
) ]
), ],
), ],
'types' => array( 'types' => [
'0' => array('showitem' => 'hidden;;;;1-1-1, name, email_notification, email_paypal') '0' => ['showitem' => 'hidden;;;;1-1-1, name, email_notification, email_paypal']
), ],
'palettes' => array() 'palettes' => []
); ];
<?php <?php
if (!defined('TYPO3_MODE')) { if (!defined('TYPO3_MODE')) {
die ('Access denied.'); die('Access denied.');
} }
return array( return [
'ctrl' => array( 'ctrl' => [
'title' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_donation', 'title' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_donation',
'label' => 'name', 'label' => 'name',
'tstamp' => 'tstamp', 'tstamp' => 'tstamp',
'crdate' => 'crdate', 'crdate' => 'crdate',
'cruser_id' => 'cruser_id', 'cruser_id' => 'cruser_id',
'default_sortby' => "ORDER BY crdate DESC", 'default_sortby' => 'ORDER BY crdate DESC',
'delete' => 'deleted', 'delete' => 'deleted',
'enablecolumns' => array( 'enablecolumns' => [
'disabled' => 'hidden', 'disabled' => 'hidden',
), ],
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3o_donation') . 'Configuration/TCA/tx_t3odonation_domain_model_donation.php', 'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3o_donation') . 'Configuration/TCA/tx_t3odonation_domain_model_donation.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3o_donation') . 'Resources/Public/Icons/tx_t3odonation_domain_model_donation.gif', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3o_donation') . 'Resources/Public/Icons/tx_t3odonation_domain_model_donation.gif',
'dividers2tabs' => true, 'dividers2tabs' => true,
), ],
'interface' => array( 'interface' => [
'showRecordFieldList' => 'hidden,name,company,address,address_street,address_zip,address_city,address_state,address_country,address_country_code,email,amount,fee,currency,url,comment,paypal_transaction_id,feuser,account' 'showRecordFieldList' => 'hidden,name,company,address,address_street,address_zip,address_city,address_state,address_country,address_country_code,email,amount,fee,currency,url,comment,paypal_transaction_id,feuser,account'
), ],
'columns' => array( 'columns' => [
'hidden' => array( 'hidden' => [
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden', 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array( 'config' => [
'type' => 'check', 'type' => 'check',
'default' => '0' 'default' => '0'
) ]
), ],
'name' => array( 'name' => [
'exclude' => 0, 'exclude' => 0,
'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_donation.name', 'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_donation.name',
'config' => array( 'config' => [
'type' => 'input', 'type' => 'input',
'size' => '30', 'size' => '30',
'eval' => 'trim', 'eval' => 'trim',
) ]
), ],
'company' => array( 'company' => [
'exclude' => 0, 'exclude' => 0,
'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_donation.company', 'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_donation.company',
'config' => array( 'config' => [
'type' => 'input', 'type' => 'input',
'size' => '30', 'size' => '30',
'eval' => 'trim', 'eval' => 'trim',
) ]
), ],
'address' => array( 'address' => [
'exclude' => 1, 'exclude' => 1,