improve code syntax

This commit is contained in:
Daniel Seifert 2023-01-17 09:15:27 +01:00
parent 2897097076
commit bd466266cc
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
16 changed files with 51 additions and 51 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -26,4 +26,4 @@ $aLang = [
'D3LM_EXC_NO_RECIPIENT_SET' => 'Kein (verwendbarer) Empfänger für die Benachrichtigung vorhanden.',
];
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreEnd

View File

@ -26,4 +26,4 @@ $aLang = [
'D3LM_EXC_NO_RECIPIENT_SET' => 'No (usable) recipient for the message available.',
];
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreEnd

View File

@ -60,4 +60,4 @@ $aLang = [
'tbclorder_linkmobility' => 'SMS-Versand'
];
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreEnd

View File

@ -60,4 +60,4 @@ $aLang = [
'tbclorder_linkmobility' => 'sending SMS'
];
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreEnd

View File

@ -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));
}
/**

View File

@ -180,7 +180,7 @@ class Actions
*/
public function checkCmsItems()
{
foreach(
foreach (
[
'd3linkmobilityordercanceled' => 'addCms1Item',
'd3linkmobilityfinishedorder' => 'addCms2Item',

View File

@ -81,4 +81,4 @@ abstract class LMIntegrationTestCase extends LMUnitTestCase
d3GetOxidDIC()->set(MessageClient::class, $messageClientMock);
}
}
}

View File

@ -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();
}
}
}

View File

@ -407,4 +407,4 @@ class adminUserTest extends LMIntegrationTestCase
$this->user->delete();
}
}
}

View File

@ -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();
}
}
}

View File

@ -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();
}
}
}

View File

@ -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();
}
}
}

View File

@ -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(