From c66a085863a89a9b0fbce1b235afcdb619cac6c2 Mon Sep 17 00:00:00 2001 From: Pablo Ogando Ferreira Date: Mon, 16 Oct 2023 09:47:43 +0200 Subject: [PATCH] TTK-26618 PHPCsFixer && PHPStan --- Command/renewedVideosWithoutOwnerCommand.php | 15 ++++++++++++--- Services/ExpiredVideoNotificationService.php | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Command/renewedVideosWithoutOwnerCommand.php b/Command/renewedVideosWithoutOwnerCommand.php index b7b4d1e..878381a 100644 --- a/Command/renewedVideosWithoutOwnerCommand.php +++ b/Command/renewedVideosWithoutOwnerCommand.php @@ -4,7 +4,9 @@ namespace Pumukit\ExpiredVideoBundle\Command; +use Doctrine\ODM\MongoDB\DocumentManager; use Pumukit\ExpiredVideoBundle\Services\ExpiredVideoConfigurationService; +use Pumukit\ExpiredVideoBundle\Services\ExpiredVideoService; use Pumukit\SchemaBundle\Document\Role; use Pumukit\SchemaBundle\Document\Tag; use Symfony\Component\Console\Command\Command; @@ -24,6 +26,16 @@ class renewedVideosWithoutOwnerCommand extends Command private $addPublishTag; private $renewDate; + public function __construct( + DocumentManager $documentManager, + ExpiredVideoService $expiredVideoService, + ExpiredVideoConfigurationService $expiredVideoConfigurationService + ) { + $this->expiredVideoService = $expiredVideoService; + $this->expiredVideoConfigurationService = $expiredVideoConfigurationService; + $this->documentManager = $documentManager; + } + protected function configure(): void { $this @@ -54,9 +66,6 @@ protected function configure(): void protected function initialize(InputInterface $input, OutputInterface $output): void { - $this->expiredVideoService = $this->getContainer()->get('pumukit_expired_video.expired_video'); - $this->expiredVideoConfigurationService = $this->getContainer()->get('pumukit_expired_video.configuration'); - $this->documentManager = $this->getContainer()->get('doctrine.odm.mongodb.document_manager'); $this->force = (true === $input->getOption('force')); $this->user = $input->getOption('user'); $this->addPublishTag = $input->getOption('addPublishTag'); diff --git a/Services/ExpiredVideoNotificationService.php b/Services/ExpiredVideoNotificationService.php index e5baae5..27e6f21 100644 --- a/Services/ExpiredVideoNotificationService.php +++ b/Services/ExpiredVideoNotificationService.php @@ -148,7 +148,7 @@ private function generateDataForMultimediaObject(string $multimediaObjectId): ar $mmObj = $this->getMultimediaObjectById($multimediaObjectId); $renewMultimediaObjectToken = $mmObj->getProperty($this->expiredVideoConfigurationService->getMultimediaObjectPropertyRenewKey()); - if (!$renewMultimediaObjectToken || empty($renewMultimediaObjectToken)) { + if (empty($renewMultimediaObjectToken)) { $renewMultimediaObjectToken = TokenUtils::generateExpiredToken(); }