diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..775f18f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.php_cs.cache \ No newline at end of file diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 244806f..e5e32a0 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -6,7 +6,7 @@ $finder = PhpCsFixer\Finder::create() $config = new PhpCsFixer\Config(); return $config->setRules([ - '@PHP70Migration' => true, + '@PHP71Migration' => true, '@PSR12' => true ]) ->setFinder($finder) diff --git a/src/Application/Model/Configuration.php b/src/Application/Model/Configuration.php index 68c5143..e15a52f 100644 --- a/src/Application/Model/Configuration.php +++ b/src/Application/Model/Configuration.php @@ -22,21 +22,21 @@ use OxidEsales\Eshop\Core\Registry; class Configuration { - const GENERAL_APITOKEN = "d3linkmobility_apitoken"; - const GENERAL_DEBUG = "d3linkmobility_debug"; + public const GENERAL_APITOKEN = "d3linkmobility_apitoken"; + public const GENERAL_DEBUG = "d3linkmobility_debug"; - const ORDER_RECFIELDS = "d3linkmobility_smsOrderRecipientsFields"; - const USER_RECFIELDS = "d3linkmobility_smsUserRecipientsFields"; + public const ORDER_RECFIELDS = "d3linkmobility_smsOrderRecipientsFields"; + public const USER_RECFIELDS = "d3linkmobility_smsUserRecipientsFields"; - const SMS_SENDERNR = "d3linkmobility_smsSenderNumber"; - const SMS_SENDERCOUNTRY = "d3linkmobility_smsSenderCountry"; + public const SMS_SENDERNR = "d3linkmobility_smsSenderNumber"; + public const SMS_SENDERCOUNTRY = "d3linkmobility_smsSenderCountry"; - const SENDBY_ORDERED = "d3linkmobility_orderActive"; - const SENDBY_SENDEDNOW = "d3linkmobility_sendedNowActive"; - const SENDBY_CANCELED = "d3linkmobility_cancelOrderActive"; + public const SENDBY_ORDERED = "d3linkmobility_orderActive"; + public const SENDBY_SENDEDNOW = "d3linkmobility_sendedNowActive"; + public const SENDBY_CANCELED = "d3linkmobility_cancelOrderActive"; - const ARGS_CHECKKEYS = "checkKeys"; - const ARGS_CHECKCLASS = "checkClassName"; + public const ARGS_CHECKKEYS = "checkKeys"; + public const ARGS_CHECKCLASS = "checkClassName"; /** * @return string diff --git a/src/Application/Model/MessageSender.php b/src/Application/Model/MessageSender.php index 43bd2ee..7060e7d 100644 --- a/src/Application/Model/MessageSender.php +++ b/src/Application/Model/MessageSender.php @@ -30,7 +30,7 @@ class MessageSender public function sendOrderFinishedMessage(Order $order, $messageBody) { if ((oxNew(Configuration::class))->sendOrderFinishedMessage()) { - $this->sendMessageByOrder( $order, $messageBody); + $this->sendMessageByOrder($order, $messageBody); } } diff --git a/src/Application/Model/MessageTypes/AbstractMessage.php b/src/Application/Model/MessageTypes/AbstractMessage.php index 1bc8c70..b51eca0 100644 --- a/src/Application/Model/MessageTypes/AbstractMessage.php +++ b/src/Application/Model/MessageTypes/AbstractMessage.php @@ -22,7 +22,7 @@ use OxidEsales\Eshop\Application\Model\Remark; abstract class AbstractMessage { - const REMARK_IDENT = 'LINKMOB'; + public const REMARK_IDENT = 'LINKMOB'; protected $message; protected $removeLineBreaks = true; @@ -109,5 +109,5 @@ abstract class AbstractMessage return $this->removeMultipleSpaces ? preg_replace($regexp, ' ', $message) : $message; } - abstract public function getTypeName() : string; + abstract public function getTypeName(): string; } diff --git a/src/Application/Model/OrderRecipients.php b/src/Application/Model/OrderRecipients.php index 788732e..34084c2 100644 --- a/src/Application/Model/OrderRecipients.php +++ b/src/Application/Model/OrderRecipients.php @@ -43,17 +43,17 @@ class OrderRecipients { foreach ($this->getSmsRecipientFields() as $phoneFieldName => $countryIdFieldName) { $content = trim((string) $this->order->getFieldData($phoneFieldName)); - $country = oxNew( Country::class ); + $country = oxNew(Country::class); try { - if ( strlen( $content ) ) { - $country->load( $this->order->getFieldData( $countryIdFieldName ) ); - return oxNew( Recipient::class, $content, $country->getFieldData( 'oxisoalpha2' ) ); + if (strlen($content)) { + $country->load($this->order->getFieldData($countryIdFieldName)); + return oxNew(Recipient::class, $content, $country->getFieldData('oxisoalpha2')); } } catch (NumberParseException $e) { - LoggerHandler::getInstance()->getLogger()->info($e->getMessage(), [$content, $country->getFieldData( 'oxisoalpha2' )]); + LoggerHandler::getInstance()->getLogger()->info($e->getMessage(), [$content, $country->getFieldData('oxisoalpha2')]); } catch (RecipientException $e) { - LoggerHandler::getInstance()->getLogger()->info($e->getMessage(), [$content, $country->getFieldData( 'oxisoalpha2' )]); + LoggerHandler::getInstance()->getLogger()->info($e->getMessage(), [$content, $country->getFieldData('oxisoalpha2')]); } } diff --git a/src/Application/Model/UserRecipients.php b/src/Application/Model/UserRecipients.php index c5fbaf6..f6828df 100644 --- a/src/Application/Model/UserRecipients.php +++ b/src/Application/Model/UserRecipients.php @@ -43,17 +43,17 @@ class UserRecipients { foreach ($this->getSmsRecipientFields() as $fieldName) { $content = trim($this->user->getFieldData($fieldName)); - $country = oxNew( Country::class ); + $country = oxNew(Country::class); try { - if ( strlen( $content ) ) { - $country->load( $this->user->getFieldData( 'oxcountryid' ) ); - return oxNew( Recipient::class, $content, $country->getFieldData( 'oxisoalpha2' ) ); + if (strlen($content)) { + $country->load($this->user->getFieldData('oxcountryid')); + return oxNew(Recipient::class, $content, $country->getFieldData('oxisoalpha2')); } } catch (NumberParseException $e) { - LoggerHandler::getInstance()->getLogger()->info($e->getMessage(), [$content, $country->getFieldData( 'oxisoalpha2' )]); + LoggerHandler::getInstance()->getLogger()->info($e->getMessage(), [$content, $country->getFieldData('oxisoalpha2')]); } catch (RecipientException $e) { - LoggerHandler::getInstance()->getLogger()->info($e->getMessage(), [$content, $country->getFieldData( 'oxisoalpha2' )]); + LoggerHandler::getInstance()->getLogger()->info($e->getMessage(), [$content, $country->getFieldData('oxisoalpha2')]); } }