From 3df76a3e2a77a36c3174e5f5a572ebf4c219f35c Mon Sep 17 00:00:00 2001 From: amirinterlutions Date: Fri, 1 Mar 2024 14:46:06 +0100 Subject: [PATCH] PAYOSWXP-121: fixes phpstan --- .../ResendNotifyHandler.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Components/ResendNotifyHandler/ResendNotifyHandler.php b/src/Components/ResendNotifyHandler/ResendNotifyHandler.php index 80ac33d3..919f9d95 100644 --- a/src/Components/ResendNotifyHandler/ResendNotifyHandler.php +++ b/src/Components/ResendNotifyHandler/ResendNotifyHandler.php @@ -33,13 +33,19 @@ public function send(): void /** @var PayonePaymentNotificationQueueEntity $notification */ foreach ($notificationQueue as $notification) { - $messageDecode = base64_decode($notification->getMessage() ?: '', true); - /** @var NotificationForwardCommand $message */ - $message = unserialize($messageDecode, []); - - $this->notificationForwardHandler->handle($message, true); - $this->notificationQueueRepository->delete([['id' => $notification->getId()]], Context::createDefaultContext()); + $messageDecode = null; + if ($notification->getMessage() !== null) { + $messageDecode = base64_decode($notification->getMessage(), true); + } + if ($messageDecode !== null) { + /** @var NotificationForwardCommand $message */ + $message = unserialize($messageDecode, []); + + $this->notificationForwardHandler->handle($message, true); + $this->notificationQueueRepository->delete([['id' => $notification->getId()]], Context::createDefaultContext()); + } } + echo 'current time: ' . $currentDate->format(Defaults::STORAGE_DATE_TIME_FORMAT) . "\n"; } }