fix code style

This commit is contained in:
Daniel Seifert 2022-08-07 22:18:23 +02:00
bovenliggende 42cf5721ce
commit 817f9e68a2
Getekend door: DanielS
GPG sleutel-ID: 6A513E13AEE66170
10 gewijzigde bestanden met toevoegingen van 62 en 42 verwijderingen

1
.gitignore vendored Normal file
Bestand weergeven

@ -0,0 +1 @@
.php_cs.cache

12
.php-cs-fixer.php Normal file
Bestand weergeven

@ -0,0 +1,12 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PHP73Migration' => true,
'@PSR12' => true
])
->setFinder($finder);

Bestand weergeven

@ -36,6 +36,10 @@
"d3/ordermanager": "^5.0",
"d3/linkmobility4oxid": "^1.0"
},
"require-dev": {
"php": "^7.4",
"friendsofphp/php-cs-fixer": "^3.9"
},
"autoload": {
"psr-4": {
"D3\\Linkmobility4Ordermanager\\": "../../../source/modules/d3/linkmobility4ordermanager"

Bestand weergeven

@ -38,28 +38,28 @@ use OxidEsales\Eshop\Core\Registry;
class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
{
public $sTplName = 'd3linkmobility_ordermanager_action.tpl';
CONST ACTIVE_SWITCH = 'blActionLinkmobility_status';
public const ACTIVE_SWITCH = 'blActionLinkmobility_status';
public $sTitleIdent = 'D3_LINKMOBILITY_ORDERMANAGER_ACTION';
CONST SOURCE_TEMPLATE = 'template';
CONST SOURCE_CMS = 'cms';
public const SOURCE_TEMPLATE = 'template';
public const SOURCE_CMS = 'cms';
/**
* @return array
*/
public final function isAllowedInEditions(): array
final public function isAllowedInEditions(): array
{
return [
d3ordermanager_conf::SERIAL_BIT_FREE_EDITION,
d3ordermanager_conf::SERIAL_BIT_STANDARD_EDITION,
d3ordermanager_conf::SERIAL_BIT_PREMIUM_EDITION
d3ordermanager_conf::SERIAL_BIT_PREMIUM_EDITION,
];
}
/**
* @return string
*/
public function getUnvalidConfigurationMessageIdent() : string
public function getUnvalidConfigurationMessageIdent(): string
{
if ($this->hasRequiredValuesNoSource(false)) {
return 'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDSOURCE';
@ -117,7 +117,8 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
{
$aMailDesc = [];
($this->getManager()->getValue('blLinkMobilityMessageToCustomer') ? $aMailDesc[] = 'Customer' : '');
($this->getManager()->getValue('blLinkMobilityMessageToCustom') ?
(
$this->getManager()->getValue('blLinkMobilityMessageToCustom') ?
$aMailDesc[] = 'Custom: ' . $this->getManager()->getValue('sLinkMobilityMessageToCustomAddress') :
''
);
@ -144,7 +145,7 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
*/
protected function hasRequiredValuesNoSource(bool $blExpected): bool
{
$source = (string) $this->getManager()->getValue( 'sLinkMobilityMessageFromSource' );
$source = (string) $this->getManager()->getValue('sLinkMobilityMessageFromSource');
$return = strlen(trim($source)) &&
in_array(trim($source), [self::SOURCE_CMS, self::SOURCE_TEMPLATE]);
@ -159,21 +160,21 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
*/
protected function hasRequiredValuesTplSource(bool $blExpected): bool
{
$source = (string) $this->getManager()->getValue( 'sLinkMobilityMessageFromSource' );
$source = (string) $this->getManager()->getValue('sLinkMobilityMessageFromSource');
if (trim($source) !== self::SOURCE_TEMPLATE) {
return false;
}
$template = (string) $this->getManager()->getValue( 'sLinkMobilityMessageFromTemplatename' );
$theme = (string) $this->getManager()->getValue( 'sLinkMobilityMessageFromTheme' );
$template = (string) $this->getManager()->getValue('sLinkMobilityMessageFromTemplatename');
$theme = (string) $this->getManager()->getValue('sLinkMobilityMessageFromTheme');
if ($blExpected === true) {
return (bool) strlen( trim( $template ) ) === true &&
(bool) strlen( trim( $theme ) ) === true;
return (bool) strlen(trim($template)) === true &&
(bool) strlen(trim($theme)) === true;
} else {
return (bool) strlen( trim( $template ) ) === false ||
(bool) strlen( trim( $theme ) ) === false;
return (bool) strlen(trim($template)) === false ||
(bool) strlen(trim($theme)) === false;
}
}
@ -184,7 +185,7 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
*/
protected function hasRequiredValuesCmsSource(bool $blExpected): bool
{
$source = (string) $this->getManager()->getValue( 'sLinkMobilityMessageFromSource' );
$source = (string) $this->getManager()->getValue('sLinkMobilityMessageFromSource');
if (trim($source) !== self::SOURCE_CMS) {
return false;
@ -192,14 +193,14 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
/** @var Content $content */
$content = oxNew(Content::class);
$contentname = (string) $this->getManager()->getValue( 'sLinkMobilityMessageFromContentname' );
$contentname = (string) $this->getManager()->getValue('sLinkMobilityMessageFromContentname');
if ($blExpected === true) {
return (bool) strlen( trim( $contentname ) ) === true &&
$content->exists(trim( $contentname )) === true;
return (bool) strlen(trim($contentname)) === true &&
$content->exists(trim($contentname)) === true;
} else {
return (bool) strlen( trim( $contentname ) ) === false ||
$content->exists(trim( $contentname )) === false;
return (bool) strlen(trim($contentname)) === false ||
$content->exists(trim($contentname)) === false;
}
}
@ -208,14 +209,14 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
*/
protected function hasRequiredValuesRecipient(): bool
{
$toCust = (bool) $this->getManager()->getValue( 'blLinkMobilityMessageToCustomer' );
$toCustom = (bool) $this->getManager()->getValue( 'blLinkMobilityMessageToCustom' );
$toCustomAddress = (string) $this->getManager()->getValue( 'sLinkMobilityMessageToCustomAddress' );
$toCust = (bool) $this->getManager()->getValue('blLinkMobilityMessageToCustomer');
$toCustom = (bool) $this->getManager()->getValue('blLinkMobilityMessageToCustom');
$toCustomAddress = (string) $this->getManager()->getValue('sLinkMobilityMessageToCustomAddress');
return $toCust || (
$toCustom &&
(bool) strlen( trim( $toCustomAddress ) )
);
$toCustom &&
(bool) strlen(trim($toCustomAddress))
);
}
/**
@ -272,8 +273,8 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
/**
* @return string
*/
public function getActiveSwitchParameter() : string
public function getActiveSwitchParameter(): string
{
return self::ACTIVE_SWITCH;
}
}
}

Bestand weergeven

@ -24,4 +24,4 @@ class emptyMesageException extends StandardException
$sMessage = 'empty message content in task '.$sMessage;
parent::__construct($sMessage, $iCode, $previous);
}
}
}

Bestand weergeven

@ -123,7 +123,7 @@ class d3linkmobility_ordermanager_sender
// ToDo: check in TWIG and change to a generic solution (e.g. path names in template name)
// Smarty only
if (method_exists($templateEngine, '__set')) {
$templateEngine->__set( 'template_dir', $this->getTemplateDir4OrderManager( $oManager ) );
$templateEngine->__set('template_dir', $this->getTemplateDir4OrderManager($oManager));
}
foreach ($viewData as $id => $value) {
@ -190,7 +190,7 @@ class d3linkmobility_ordermanager_sender
* @param Manager $oManager
* @return string
*/
public function getTemplateDir4OrderManager( Manager $oManager ): string
public function getTemplateDir4OrderManager(Manager $oManager): string
{
if ($oManager->getValue('sLinkMobilityMessageFromTheme') == 'module') {
$sModuleId = $oManager->getValue('sLinkMobilityMessageFromModulePath');
@ -261,7 +261,7 @@ class d3linkmobility_ordermanager_sender
if (strlen($customAddresses)) {
foreach (explode(';', $customAddresses) as $addressGroups) {
list($phoneNumber, $countryId) = explode('@', trim($addressGroups));
[$phoneNumber, $countryId] = explode('@', trim($addressGroups));
$addresses[trim($phoneNumber)] = trim($countryId);
}
}
@ -300,4 +300,4 @@ class d3linkmobility_ordermanager_sender
{
return $this->manager;
}
}
}

Bestand weergeven

@ -17,7 +17,7 @@ declare(strict_types=1);
$sLangName = 'Deutsch';
$aLang = array(
$aLang = [
'charset' => 'UTF-8',
'D3_LINKMOBILITY_ORDERMANAGER_ACTION' => 'SMS senden (via LINK Mobility)',
@ -53,6 +53,6 @@ $aLang = array(
'D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE_EMPTYMESSAGE' => 'SMS wurde wegen leerer Nachricht nicht gesendet',
'D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE_NORECIPIENT' => 'SMS wurde wegen fehlender Empfänger nicht gesendet',
'D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE_RECIPIENTERROR' => 'SMS Empfänger %1$s (%2$s) konnte nicht verwendet werden',
);
];
// @codeCoverageIgnoreEnd

Bestand weergeven

@ -17,5 +17,7 @@ namespace D3\Linkmobility4Ordermanager\Modules\Ordermanager\Application\Model
{
use D3\Ordermanager\Application\Model\d3ordermanager_conf;
class d3ordermanager_conf_linkmobility_parent extends d3ordermanager_conf {}
}
class d3ordermanager_conf_linkmobility_parent extends d3ordermanager_conf
{
}
}

Bestand weergeven

@ -53,4 +53,4 @@ class d3ordermanager_conf_linkmobility extends d3ordermanager_conf_linkmobility_
return $moduleStateService->isActive('d3linkmobility', Registry::getConfig()->getShopId());
}
}
}

Bestand weergeven

@ -36,13 +36,13 @@ $aModule = [
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',
'extend' => [
d3ordermanager_conf::class => d3ordermanager_conf_linkmobility::class
d3ordermanager_conf::class => d3ordermanager_conf_linkmobility::class,
],
'controllers' => [],
'templates' => [
'd3linkmobility_ordermanager_action.tpl' => 'd3/linkmobility4ordermanager/Application/views/admin/tpl/d3linkmobility_ordermanager_action.tpl'
'd3linkmobility_ordermanager_action.tpl' => 'd3/linkmobility4ordermanager/Application/views/admin/tpl/d3linkmobility_ordermanager_action.tpl',
],
'events' => [],
'blocks' => [],
'settings' => []
'settings' => [],
];