improve code

This commit is contained in:
Daniel Seifert 2023-12-12 11:43:46 +01:00
parent 0dbd956a68
commit d6a2373c31
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
5 changed files with 18 additions and 11 deletions

View File

@ -18,6 +18,7 @@ namespace D3\MailConfigChecker\Application\Controller\Admin;
use Assert\Assert; use Assert\Assert;
use D3\MailConfigChecker\Application\Model\Exception\d3TranslatableLazyAssertionException; use D3\MailConfigChecker\Application\Model\Exception\d3TranslatableLazyAssertionException;
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController; use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Application\Model\Shop;
use OxidEsales\Eshop\Core\Email; use OxidEsales\Eshop\Core\Email;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
@ -78,6 +79,7 @@ class MailTester extends AdminDetailsController
public function getMailAddressList() public function getMailAddressList()
{ {
/** @var Shop $shop */
$shop = Registry::getConfig()->getActiveShop(); $shop = Registry::getConfig()->getActiveShop();
return array_filter( return array_filter(

View File

@ -52,9 +52,9 @@ class SmtpChecker extends AdminDetailsController
list( 'host' => $shopHost, 'port' => $shopPort ) = parse_url( trim($activeShop->getFieldData( 'oxsmtp' )) ); list( 'host' => $shopHost, 'port' => $shopPort ) = parse_url( trim($activeShop->getFieldData( 'oxsmtp' )) );
} }
$this->host = $shopHost ?? null; $this->host = $shopHost;
$this->addTplParam('smtpHost', Registry::getRequest()->getRequestEscapedParameter('smtpHost')); $this->addTplParam('smtpHost', Registry::getRequest()->getRequestEscapedParameter('smtpHost'));
$this->port = $shopPort ?? null; $this->port = $shopPort;
$this->user = Registry::getRequest()->getRequestEscapedParameter('smtpUser') ?: $activeShop->getFieldData('oxsmtpuser'); $this->user = Registry::getRequest()->getRequestEscapedParameter('smtpUser') ?: $activeShop->getFieldData('oxsmtpuser');
$this->addTplParam('smtpUser', $this->user); $this->addTplParam('smtpUser', $this->user);
$this->pwd = Registry::getRequest()->getRequestEscapedParameter('smtpPwd') ?: $activeShop->getFieldData('oxsmtppwd'); $this->pwd = Registry::getRequest()->getRequestEscapedParameter('smtpPwd') ?: $activeShop->getFieldData('oxsmtppwd');
@ -82,6 +82,7 @@ class SmtpChecker extends AdminDetailsController
public function getMailAddressList() public function getMailAddressList()
{ {
/** @var Shop $shop */
$shop = Registry::getConfig()->getActiveShop(); $shop = Registry::getConfig()->getActiveShop();
return array_filter( return array_filter(

View File

@ -22,6 +22,7 @@ use Mika56\SPFCheck\Model\Query;
use Mika56\SPFCheck\Model\Result; use Mika56\SPFCheck\Model\Result;
use Mika56\SPFCheck\SPFCheck; use Mika56\SPFCheck\SPFCheck;
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController; use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Application\Model\Shop;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
class SpfChecker extends AdminDetailsController class SpfChecker extends AdminDetailsController
@ -50,6 +51,9 @@ class SpfChecker extends AdminDetailsController
protected function getMailDomains() protected function getMailDomains()
{ {
/** @var Shop $shop */
$shop = Registry::getConfig()->getActiveShop();
return return
array_filter( array_filter(
array_unique( array_unique(
@ -68,9 +72,9 @@ class SpfChecker extends AdminDetailsController
} }
}, },
[ [
Registry::getConfig()->getActiveShop()->getFieldData('oxinfoemail'), $shop->getFieldData('oxinfoemail'),
Registry::getConfig()->getActiveShop()->getFieldData('oxorderemail'), $shop->getFieldData('oxorderemail'),
Registry::getConfig()->getActiveShop()->getFieldData('oxowneremail'), $shop->getFieldData('oxowneremail'),
] ]
) )
) )

View File

@ -30,6 +30,6 @@ class d3TranslatableLazyAssertionException extends LazyAssertionException
$message .= sprintf( "%d) %s: %s\n", $i ++, $error->getPropertyPath(), $error->getMessage() ); $message .= sprintf( "%d) %s: %s\n", $i ++, $error->getPropertyPath(), $error->getMessage() );
} }
return new static($message, $errors); return new LazyAssertionException($message, $errors);
} }
} }

View File

@ -1,10 +1,10 @@
parameters: parameters:
scanFiles: scanFiles:
- IntelliSenseHelper.php
- ../../oxid-esales/oxideshop-ce/source/oxfunctions.php - ../../oxid-esales/oxideshop-ce/source/oxfunctions.php
- ../../oxid-esales/oxideshop-ce/source/overridablefunctions.php - ../../oxid-esales/oxideshop-ce/source/overridablefunctions.php
level: 9 paths:
phpVersion: 70100 - .
level: 4
phpVersion: 70300
checkMissingIterableValueType: false checkMissingIterableValueType: false
ignoreErrors:
- '#Psr\\Container\\ContainerExceptionInterface is not subtype of Throwable#'