From bd466266cc2ec3635309ba9109a1be4eb1331707 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Tue, 17 Jan 2023 09:15:27 +0100 Subject: [PATCH] improve code syntax --- .../Controller/Admin/AdminOrder.php | 8 ++++---- src/Application/Controller/Admin/AdminUser.php | 8 ++++---- src/Application/Model/MessageSender.php | 8 ++++---- .../translations/de/d3Linkmobility_lang.php | 2 +- .../translations/en/d3Linkmobility_lang.php | 2 +- .../views/admin/de/d3Linkmobility_lang.php | 2 +- .../views/admin/en/d3Linkmobility_lang.php | 2 +- src/Modules/Core/EmailCore.php | 4 ++-- src/Setup/Actions.php | 2 +- .../integration/LMIntegrationTestCase.php | 2 +- src/tests/integration/adminOrderTest.php | 6 +++--- src/tests/integration/adminUserTest.php | 2 +- src/tests/integration/canceledOrderTest.php | 12 ++++++------ src/tests/integration/finishedOrderTest.php | 12 ++++++------ src/tests/integration/sendedNowOrderTest.php | 12 ++++++------ .../Application/Model/MessageSenderTest.php | 18 +++++++++--------- 16 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/Application/Controller/Admin/AdminOrder.php b/src/Application/Controller/Admin/AdminOrder.php index d3b84d0..e83c549 100644 --- a/src/Application/Controller/Admin/AdminOrder.php +++ b/src/Application/Controller/Admin/AdminOrder.php @@ -67,10 +67,10 @@ class AdminOrder extends AdminController protected function sendMessage(): string { try { - $sms = $this->getSms( $this->getMessageBody() ); - return $sms->sendOrderMessage( $this->item ) ? - $this->getSuccessSentMessage( $sms )->getMessage() : - $this->getUnsuccessfullySentMessage( $sms ); + $sms = $this->getSms($this->getMessageBody()); + return $sms->sendOrderMessage($this->item) ? + $this->getSuccessSentMessage($sms)->getMessage() : + $this->getUnsuccessfullySentMessage($sms); } catch (noRecipientFoundException $e) { /** @var LoggerHandler $loggerHandler */ $loggerHandler = d3GetOxidDIC()->get(LoggerHandler::class); diff --git a/src/Application/Controller/Admin/AdminUser.php b/src/Application/Controller/Admin/AdminUser.php index 59c9bd5..ab9f5df 100644 --- a/src/Application/Controller/Admin/AdminUser.php +++ b/src/Application/Controller/Admin/AdminUser.php @@ -69,11 +69,11 @@ class AdminUser extends AdminController protected function sendMessage(): string { try { - $sms = $this->getSms( $this->getMessageBody() ); + $sms = $this->getSms($this->getMessageBody()); - return $sms->sendUserAccountMessage( $this->item ) ? - $this->getSuccessSentMessage( $sms )->getMessage() : - $this->getUnsuccessfullySentMessage( $sms ); + return $sms->sendUserAccountMessage($this->item) ? + $this->getSuccessSentMessage($sms)->getMessage() : + $this->getUnsuccessfullySentMessage($sms); } catch (noRecipientFoundException $e) { /** @var LoggerHandler $loggerHandler */ $loggerHandler = d3GetOxidDIC()->get(LoggerHandler::class); diff --git a/src/Application/Model/MessageSender.php b/src/Application/Model/MessageSender.php index 7d86d9e..e765cc8 100644 --- a/src/Application/Model/MessageSender.php +++ b/src/Application/Model/MessageSender.php @@ -33,8 +33,8 @@ class MessageSender public function sendOrderFinishedMessage(Order $order, string $messageBody): void { try { - if ( $this->getConfiguration()->sendOrderFinishedMessage() ) { - $this->sendMessageByOrder( $order, $messageBody ); + if ($this->getConfiguration()->sendOrderFinishedMessage()) { + $this->sendMessageByOrder($order, $messageBody); } } catch (noRecipientFoundException $e) { /** @var LoggerHandler $loggerHandler */ @@ -52,8 +52,8 @@ class MessageSender public function sendSendedNowMessage(Order $order, string $messageBody): void { try { - if ( $this->getConfiguration()->sendOrderSendedNowMessage() ) { - $this->sendMessageByOrder( $order, $messageBody ); + if ($this->getConfiguration()->sendOrderSendedNowMessage()) { + $this->sendMessageByOrder($order, $messageBody); } } catch (noRecipientFoundException $e) { /** @var LoggerHandler $loggerHandler */ diff --git a/src/Application/translations/de/d3Linkmobility_lang.php b/src/Application/translations/de/d3Linkmobility_lang.php index 7b454e2..f8309e4 100644 --- a/src/Application/translations/de/d3Linkmobility_lang.php +++ b/src/Application/translations/de/d3Linkmobility_lang.php @@ -26,4 +26,4 @@ $aLang = [ 'D3LM_EXC_NO_RECIPIENT_SET' => 'Kein (verwendbarer) Empfänger für die Benachrichtigung vorhanden.', ]; -// @codeCoverageIgnoreEnd \ No newline at end of file +// @codeCoverageIgnoreEnd diff --git a/src/Application/translations/en/d3Linkmobility_lang.php b/src/Application/translations/en/d3Linkmobility_lang.php index ab30fff..fda2bdf 100644 --- a/src/Application/translations/en/d3Linkmobility_lang.php +++ b/src/Application/translations/en/d3Linkmobility_lang.php @@ -26,4 +26,4 @@ $aLang = [ 'D3LM_EXC_NO_RECIPIENT_SET' => 'No (usable) recipient for the message available.', ]; -// @codeCoverageIgnoreEnd \ No newline at end of file +// @codeCoverageIgnoreEnd diff --git a/src/Application/views/admin/de/d3Linkmobility_lang.php b/src/Application/views/admin/de/d3Linkmobility_lang.php index 468c286..07f8010 100644 --- a/src/Application/views/admin/de/d3Linkmobility_lang.php +++ b/src/Application/views/admin/de/d3Linkmobility_lang.php @@ -60,4 +60,4 @@ $aLang = [ 'tbclorder_linkmobility' => 'SMS-Versand' ]; -// @codeCoverageIgnoreEnd \ No newline at end of file +// @codeCoverageIgnoreEnd diff --git a/src/Application/views/admin/en/d3Linkmobility_lang.php b/src/Application/views/admin/en/d3Linkmobility_lang.php index 5ad1943..1b45b1b 100644 --- a/src/Application/views/admin/en/d3Linkmobility_lang.php +++ b/src/Application/views/admin/en/d3Linkmobility_lang.php @@ -60,4 +60,4 @@ $aLang = [ 'tbclorder_linkmobility' => 'sending SMS' ]; -// @codeCoverageIgnoreEnd \ No newline at end of file +// @codeCoverageIgnoreEnd diff --git a/src/Modules/Core/EmailCore.php b/src/Modules/Core/EmailCore.php index 87b96ec..2be5730 100644 --- a/src/Modules/Core/EmailCore.php +++ b/src/Modules/Core/EmailCore.php @@ -89,8 +89,8 @@ class EmailCore extends EmailCore_parent public function d3SendOrderFinishedMessageToUser(Order $order): void { /** @var MessageSender $messageSender */ - $messageSender = d3GetOxidDIC()->get( MessageSender::class ); - $messageSender->sendOrderFinishedMessage( $order, $this->d3GetOrderFinishedSmsMessageBody( $order ) ); + $messageSender = d3GetOxidDIC()->get(MessageSender::class); + $messageSender->sendOrderFinishedMessage($order, $this->d3GetOrderFinishedSmsMessageBody($order)); } /** diff --git a/src/Setup/Actions.php b/src/Setup/Actions.php index bbae610..a48b154 100644 --- a/src/Setup/Actions.php +++ b/src/Setup/Actions.php @@ -180,7 +180,7 @@ class Actions */ public function checkCmsItems() { - foreach( + foreach ( [ 'd3linkmobilityordercanceled' => 'addCms1Item', 'd3linkmobilityfinishedorder' => 'addCms2Item', diff --git a/src/tests/integration/LMIntegrationTestCase.php b/src/tests/integration/LMIntegrationTestCase.php index 7a12402..fb478b6 100644 --- a/src/tests/integration/LMIntegrationTestCase.php +++ b/src/tests/integration/LMIntegrationTestCase.php @@ -81,4 +81,4 @@ abstract class LMIntegrationTestCase extends LMUnitTestCase d3GetOxidDIC()->set(MessageClient::class, $messageClientMock); } -} \ No newline at end of file +} diff --git a/src/tests/integration/adminOrderTest.php b/src/tests/integration/adminOrderTest.php index e48a8b9..2142d8e 100644 --- a/src/tests/integration/adminOrderTest.php +++ b/src/tests/integration/adminOrderTest.php @@ -57,7 +57,7 @@ class adminOrderTest extends LMIntegrationTestCase d3GetOxidDIC()->set(Configuration::class, $configuration); /** @var Order $order */ - $this->order = $order = oxNew( Order::class); + $this->order = $order = oxNew(Order::class); $order->setId($this->orderId); $order->assign([ 'oxbillfon' => '01512 3456789', @@ -292,7 +292,7 @@ class adminOrderTest extends LMIntegrationTestCase $_POST['messagebody'] = 'testMessage'; $_POST['oxid'] = $this->orderId; - $this->order->assign( [ + $this->order->assign([ 'oxbillfon' => '', 'oxbillcountryid' => '' ]); @@ -407,4 +407,4 @@ class adminOrderTest extends LMIntegrationTestCase $this->order->delete(); $this->user->delete(); } -} \ No newline at end of file +} diff --git a/src/tests/integration/adminUserTest.php b/src/tests/integration/adminUserTest.php index 63d4624..7266e62 100644 --- a/src/tests/integration/adminUserTest.php +++ b/src/tests/integration/adminUserTest.php @@ -407,4 +407,4 @@ class adminUserTest extends LMIntegrationTestCase $this->user->delete(); } -} \ No newline at end of file +} diff --git a/src/tests/integration/canceledOrderTest.php b/src/tests/integration/canceledOrderTest.php index ce6a171..ae439de 100644 --- a/src/tests/integration/canceledOrderTest.php +++ b/src/tests/integration/canceledOrderTest.php @@ -68,9 +68,9 @@ class canceledOrderTest extends LMIntegrationTestCase $this->user = $user = oxNew(User::class); $user->setId($this->userId); $user->save(); - + /** @var Order $order */ - $this->order = $order = oxNew( Order::class); + $this->order = $order = oxNew(Order::class); $order->setId($this->orderId); $order->assign([ 'oxbillfon' => '01512 3456789', @@ -116,7 +116,7 @@ class canceledOrderTest extends LMIntegrationTestCase 1, $container ); - + /** @var RequestInterface $request */ $request = $container[0]['request']; $this->assertTrue( @@ -162,7 +162,7 @@ class canceledOrderTest extends LMIntegrationTestCase $history ); - $this->order->assign( [ + $this->order->assign([ 'oxbillfon' => '222', 'oxbillcountryid' => 'a7c40f631fc920687.20179984', ]); @@ -324,7 +324,7 @@ class canceledOrderTest extends LMIntegrationTestCase $history ); - $this->order->assign( [ + $this->order->assign([ 'oxbillfon' => '', 'oxbillcountryid' => '' ]); @@ -416,4 +416,4 @@ class canceledOrderTest extends LMIntegrationTestCase $this->order->delete(); $this->user->delete(); } -} \ No newline at end of file +} diff --git a/src/tests/integration/finishedOrderTest.php b/src/tests/integration/finishedOrderTest.php index e6a96ab..f73dd43 100644 --- a/src/tests/integration/finishedOrderTest.php +++ b/src/tests/integration/finishedOrderTest.php @@ -71,9 +71,9 @@ class finishedOrderTest extends LMIntegrationTestCase $this->user = $user = oxNew(User::class); $user->setId($this->userId); $user->save(); - + /** @var Order $order */ - $this->order = $order = oxNew( Order::class); + $this->order = $order = oxNew(Order::class); $order->setId($this->orderId); $order->assign([ 'oxordernr' => '12345', @@ -127,7 +127,7 @@ class finishedOrderTest extends LMIntegrationTestCase 1, $container ); - + /** @var RequestInterface $request */ $request = $container[0]['request']; $this->assertTrue( @@ -173,7 +173,7 @@ class finishedOrderTest extends LMIntegrationTestCase $history ); - $this->order->assign( [ + $this->order->assign([ 'oxbillfon' => '222', 'oxbillcountryid' => 'a7c40f631fc920687.20179984', ]); @@ -356,7 +356,7 @@ class finishedOrderTest extends LMIntegrationTestCase $history ); - $this->order->assign( [ + $this->order->assign([ 'oxbillfon' => '', 'oxbillcountryid' => '' ]); @@ -462,4 +462,4 @@ class finishedOrderTest extends LMIntegrationTestCase $this->order->delete(); $this->user->delete(); } -} \ No newline at end of file +} diff --git a/src/tests/integration/sendedNowOrderTest.php b/src/tests/integration/sendedNowOrderTest.php index 2e25677..bf3b233 100644 --- a/src/tests/integration/sendedNowOrderTest.php +++ b/src/tests/integration/sendedNowOrderTest.php @@ -62,9 +62,9 @@ class sendedNowOrderTest extends LMIntegrationTestCase $this->user = $user = oxNew(User::class); $user->setId($this->userId); $user->save(); - + /** @var Order $order */ - $this->order = $order = oxNew( Order::class); + $this->order = $order = oxNew(Order::class); $order->setId($this->orderId); $order->assign([ 'oxbillfon' => '01512 3456789', @@ -112,7 +112,7 @@ class sendedNowOrderTest extends LMIntegrationTestCase 1, $container ); - + /** @var RequestInterface $request */ $request = $container[0]['request']; $this->assertTrue( @@ -158,7 +158,7 @@ class sendedNowOrderTest extends LMIntegrationTestCase $history ); - $this->order->assign( [ + $this->order->assign([ 'oxbillfon' => '222', 'oxbillcountryid' => 'a7c40f631fc920687.20179984', ]); @@ -326,7 +326,7 @@ class sendedNowOrderTest extends LMIntegrationTestCase $history ); - $this->order->assign( [ + $this->order->assign([ 'oxbillfon' => '', 'oxbillcountryid' => '' ]); @@ -430,4 +430,4 @@ class sendedNowOrderTest extends LMIntegrationTestCase $this->order->delete(); $this->user->delete(); } -} \ No newline at end of file +} diff --git a/src/tests/unit/Application/Model/MessageSenderTest.php b/src/tests/unit/Application/Model/MessageSenderTest.php index 22f33f6..69ab27c 100644 --- a/src/tests/unit/Application/Model/MessageSenderTest.php +++ b/src/tests/unit/Application/Model/MessageSenderTest.php @@ -76,10 +76,10 @@ class MessageSenderTest extends LMUnitTestCase ->getMock(); $sut->method('getConfiguration')->willReturn($configurationMock); if ($throwException) { - $sut->expects( $invocationCount )->method( 'sendMessageByOrder' ) - ->willThrowException( oxNew( noRecipientFoundException::class ) ); + $sut->expects($invocationCount)->method('sendMessageByOrder') + ->willThrowException(oxNew(noRecipientFoundException::class)); } else { - $sut->expects( $invocationCount )->method( 'sendMessageByOrder' ); + $sut->expects($invocationCount)->method('sendMessageByOrder'); } $this->callMethod( @@ -134,10 +134,10 @@ class MessageSenderTest extends LMUnitTestCase ->getMock(); $sut->method('getConfiguration')->willReturn($configurationMock); if ($throwException) { - $sut->expects( $invocationCount )->method( 'sendMessageByOrder' ) - ->willThrowException( oxNew( noRecipientFoundException::class ) ); + $sut->expects($invocationCount)->method('sendMessageByOrder') + ->willThrowException(oxNew(noRecipientFoundException::class)); } else { - $sut->expects( $invocationCount )->method( 'sendMessageByOrder' ); + $sut->expects($invocationCount)->method('sendMessageByOrder'); } $this->callMethod( @@ -192,10 +192,10 @@ class MessageSenderTest extends LMUnitTestCase ->getMock(); $sut->method('getConfiguration')->willReturn($configurationMock); if ($throwException) { - $sut->expects( $invocationCount )->method( 'sendMessageByOrder' ) - ->willThrowException( oxNew( noRecipientFoundException::class ) ); + $sut->expects($invocationCount)->method('sendMessageByOrder') + ->willThrowException(oxNew(noRecipientFoundException::class)); } else { - $sut->expects( $invocationCount )->method( 'sendMessageByOrder' ); + $sut->expects($invocationCount)->method('sendMessageByOrder'); } $this->callMethod(