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

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