Skip to content

Commit

Permalink
PHPRector
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurujai committed Oct 16, 2023
1 parent 13eef53 commit f054fed
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Command/ExpiredVideoNotificationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions EventListener/MultimediaObjectListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function __construct(

public function onMultimediaObjectCreate(MultimediaObjectEvent $event): void
{
$properties = [];
if ($this->expiredVideoConfigurationService->isDeactivatedService()) {
return;
}
Expand All @@ -49,6 +50,7 @@ public function onMultimediaObjectCreate(MultimediaObjectEvent $event): void

public function onMultimediaObjectClone(MultimediaObjectCloneEvent $event): void
{
$properties = [];
if ($this->expiredVideoConfigurationService->isDeactivatedService()) {
return;
}
Expand Down
2 changes: 2 additions & 0 deletions Services/ExpiredVideoNotificationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion Services/ExpiredVideoUpdateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
}

Expand Down

0 comments on commit f054fed

Please sign in to comment.