From f054fedf36a984c7a9de930ae7fbb03ba663cfe3 Mon Sep 17 00:00:00 2001 From: Pablo Ogando Ferreira Date: Mon, 16 Oct 2023 11:01:18 +0200 Subject: [PATCH] PHPRector --- Command/ExpiredVideoNotificationCommand.php | 2 +- EventListener/MultimediaObjectListener.php | 2 ++ Services/ExpiredVideoNotificationService.php | 2 ++ Services/ExpiredVideoUpdateService.php | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Command/ExpiredVideoNotificationCommand.php b/Command/ExpiredVideoNotificationCommand.php index 856ff73..3b76d51 100644 --- a/Command/ExpiredVideoNotificationCommand.php +++ b/Command/ExpiredVideoNotificationCommand.php @@ -71,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $expiredVideos = $this->expiredVideoService->getExpiredVideosByDateAndRange($days, $range); - if (!$expiredVideos || 0 === count($expiredVideos)) { + if (!$expiredVideos || 0 === (is_countable($expiredVideos) ? count($expiredVideos) : 0)) { $message = 'No expired video on the selected date'; $this->generateTableWithResult($output, [], $days, $message); diff --git a/EventListener/MultimediaObjectListener.php b/EventListener/MultimediaObjectListener.php index 3ba9bf7..67952d4 100644 --- a/EventListener/MultimediaObjectListener.php +++ b/EventListener/MultimediaObjectListener.php @@ -33,6 +33,7 @@ public function __construct( public function onMultimediaObjectCreate(MultimediaObjectEvent $event): void { + $properties = []; if ($this->expiredVideoConfigurationService->isDeactivatedService()) { return; } @@ -49,6 +50,7 @@ public function onMultimediaObjectCreate(MultimediaObjectEvent $event): void public function onMultimediaObjectClone(MultimediaObjectCloneEvent $event): void { + $properties = []; if ($this->expiredVideoConfigurationService->isDeactivatedService()) { return; } diff --git a/Services/ExpiredVideoNotificationService.php b/Services/ExpiredVideoNotificationService.php index 27e6f21..7f275ed 100644 --- a/Services/ExpiredVideoNotificationService.php +++ b/Services/ExpiredVideoNotificationService.php @@ -121,6 +121,7 @@ private function prepareEmailByPerson(array $elements): array private function addRenewUniqueKeys(string $userEmail, array $multimediaObjects): array { + $data = []; $data['all'] = $this->generateDataForPerson($userEmail); foreach ($multimediaObjects as $multimediaObjectId) { $data['videos'][$multimediaObjectId] = $this->generateDataForMultimediaObject($multimediaObjectId); @@ -145,6 +146,7 @@ private function generateDataForPerson(string $personEmail) private function generateDataForMultimediaObject(string $multimediaObjectId): array { + $data = []; $mmObj = $this->getMultimediaObjectById($multimediaObjectId); $renewMultimediaObjectToken = $mmObj->getProperty($this->expiredVideoConfigurationService->getMultimediaObjectPropertyRenewKey()); diff --git a/Services/ExpiredVideoUpdateService.php b/Services/ExpiredVideoUpdateService.php index a0adf67..11b5ad8 100644 --- a/Services/ExpiredVideoUpdateService.php +++ b/Services/ExpiredVideoUpdateService.php @@ -37,7 +37,7 @@ public function __construct( public function removeOwners(MultimediaObject $multimediaObject): array { - if (0 === count($multimediaObject->getRoles())) { + if (0 === (is_countable($multimediaObject->getRoles()) ? count($multimediaObject->getRoles()) : 0)) { return []; }