apply PSR-12 rules

This commit is contained in:
Daniel Seifert 2022-07-13 13:23:48 +02:00
parent f7f3ab0af4
commit 328a98f90a
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
17 changed files with 100 additions and 80 deletions

13
.php-cs-fixer.php Normal file
View File

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

View File

@ -27,7 +27,7 @@ use OxidEsales\Eshop\Core\Registry;
class AdminUser extends AdminController class AdminUser extends AdminController
{ {
const REMARK_IDENT = 'LMSMS'; public const REMARK_IDENT = 'LMSMS';
protected $_sThisTemplate = 'd3adminuser.tpl'; protected $_sThisTemplate = 'd3adminuser.tpl';

View File

@ -16,4 +16,5 @@ declare(strict_types=1);
namespace D3\Linkmobility4OXID\Application\Model\Exceptions; namespace D3\Linkmobility4OXID\Application\Model\Exceptions;
interface abortSendingExceptionInterface interface abortSendingExceptionInterface
{} {
}

View File

@ -68,7 +68,8 @@ class MessageSender
if ($sms->sendOrderMessage($order)) { if ($sms->sendOrderMessage($order)) {
$this->setRemark($order->getId(), $sms->getRecipientsList(), $sms->getMessage()); $this->setRemark($order->getId(), $sms->getRecipientsList(), $sms->getMessage());
} }
} catch (noRecipientFoundException $e) {} } catch (noRecipientFoundException $e) {
}
} }
/** /**

View File

@ -39,8 +39,7 @@ class OrderRecipients
*/ */
public function getSmsRecipient(): Recipient public function getSmsRecipient(): Recipient
{ {
foreach ($this->getSmsRecipientFields() as $phoneFieldName => $countryIdFieldName) foreach ($this->getSmsRecipientFields() as $phoneFieldName => $countryIdFieldName) {
{
$content = trim($this->order->getFieldData($phoneFieldName)); $content = trim($this->order->getFieldData($phoneFieldName));
if (strlen($content)) { if (strlen($content)) {
@ -85,7 +84,9 @@ class OrderRecipients
$checkPhoneFieldName = trim($checkPhoneFieldName); $checkPhoneFieldName = trim($checkPhoneFieldName);
$allFieldNames = oxNew(Order::class)->getFieldNames(); $allFieldNames = oxNew(Order::class)->getFieldNames();
array_walk($allFieldNames, function(&$value) {$value = strtolower($value);}); array_walk($allFieldNames, function (&$value) {
$value = strtolower($value);
});
$checkPhoneFieldName = in_array(strtolower($checkPhoneFieldName), $allFieldNames) && $checkPhoneFieldName = in_array(strtolower($checkPhoneFieldName), $allFieldNames) &&
in_array(strtolower($checkCountryFieldName), $allFieldNames) ? $checkPhoneFieldName : null; in_array(strtolower($checkCountryFieldName), $allFieldNames) ? $checkPhoneFieldName : null;

View File

@ -39,11 +39,9 @@ class UserRecipients
*/ */
public function getSmsRecipient(): Recipient public function getSmsRecipient(): Recipient
{ {
foreach ($this->getSmsRecipientFields() as $fieldName) foreach ($this->getSmsRecipientFields() as $fieldName) {
{
$content = trim($this->user->getFieldData($fieldName)); $content = trim($this->user->getFieldData($fieldName));
if (strlen($content)) { if (strlen($content)) {
$country = oxNew(Country::class); $country = oxNew(Country::class);
$country->load($this->user->getFieldData('oxcountryid')); $country->load($this->user->getFieldData('oxcountryid'));
@ -88,7 +86,9 @@ class UserRecipients
$checkFieldName = trim($checkFieldName); $checkFieldName = trim($checkFieldName);
$allFieldNames = oxNew(User::class)->getFieldNames(); $allFieldNames = oxNew(User::class)->getFieldNames();
array_walk($allFieldNames, function(&$value) {$value = strtolower($value);}); array_walk($allFieldNames, function (&$value) {
$value = strtolower($value);
});
$checkFieldName = in_array(strtolower($checkFieldName), $allFieldNames) ? $checkFieldName : null; $checkFieldName = in_array(strtolower($checkFieldName), $allFieldNames) ? $checkFieldName : null;
} }

View File

@ -17,12 +17,16 @@ namespace D3\Linkmobility4OXID\Modules\Aplication\Model {
use OxidEsales\Eshop\Application\Model\Order; use OxidEsales\Eshop\Application\Model\Order;
class OrderModel_parent extends Order{} class OrderModel_parent extends Order
{
}
} }
namespace D3\Linkmobility4OXID\Modules\Core { namespace D3\Linkmobility4OXID\Modules\Core {
use OxidEsales\Eshop\Core\Email; use OxidEsales\Eshop\Core\Email;
class EmailCore_parent extends Email{} class EmailCore_parent extends Email
{
}
} }