mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-04-09 22:43:44 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -24,7 +24,6 @@ use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\RemoteEventConverter;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
@@ -45,7 +44,7 @@ class CalendarRangeSyncer
|
||||
}
|
||||
$calendarRange->preventEnqueueChanges = true;
|
||||
|
||||
$this->logger->info(self::class . ' remove a calendar range because deleted on remote calendar');
|
||||
$this->logger->info(self::class.' remove a calendar range because deleted on remote calendar');
|
||||
$this->em->remove($calendarRange);
|
||||
|
||||
break;
|
||||
@@ -57,7 +56,7 @@ class CalendarRangeSyncer
|
||||
$notification['resource']
|
||||
)->toArray();
|
||||
} catch (ClientExceptionInterface $clientException) {
|
||||
$this->logger->warning(self::class . ' could not retrieve event from ms graph. Already deleted ?', [
|
||||
$this->logger->warning(self::class.' could not retrieve event from ms graph. Already deleted ?', [
|
||||
'calendarRangeId' => $calendarRange->getId(),
|
||||
'remoteEventId' => $notification['resource'],
|
||||
]);
|
||||
@@ -68,7 +67,7 @@ class CalendarRangeSyncer
|
||||
$lastModified = RemoteEventConverter::convertStringDateWithTimezone($new['lastModifiedDateTime']);
|
||||
|
||||
if ($calendarRange->getRemoteAttributes()['lastModifiedDateTime'] === $lastModified->getTimestamp()) {
|
||||
$this->logger->info(self::class . ' change key is equals. Source is probably a local update', [
|
||||
$this->logger->info(self::class.' change key is equals. Source is probably a local update', [
|
||||
'calendarRangeId' => $calendarRange->getId(),
|
||||
'remoteEventId' => $notification['resource'],
|
||||
]);
|
||||
@@ -90,7 +89,7 @@ class CalendarRangeSyncer
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException('This changeType is not suppored: ' . $notification['changeType']);
|
||||
throw new \RuntimeException('This changeType is not suppored: '.$notification['changeType']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,9 @@ use Chill\CalendarBundle\Entity\Invite;
|
||||
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\RemoteEventConverter;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Repository\UserRepositoryInterface;
|
||||
use LogicException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
use function in_array;
|
||||
|
||||
class CalendarSyncer
|
||||
{
|
||||
@@ -39,7 +36,7 @@ class CalendarSyncer
|
||||
match ($notification['changeType']) {
|
||||
'deleted' => $this->handleDeleteCalendar($calendar, $notification, $user),
|
||||
'updated' => $this->handleUpdateCalendar($calendar, $notification, $user),
|
||||
default => throw new RuntimeException('this change type is not supported: ' . $notification['changeType']),
|
||||
default => throw new \RuntimeException('this change type is not supported: '.$notification['changeType']),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -59,7 +56,7 @@ class CalendarSyncer
|
||||
$notification['resource']
|
||||
)->toArray();
|
||||
} catch (ClientExceptionInterface $clientException) {
|
||||
$this->logger->warning(self::class . ' could not retrieve event from ms graph. Already deleted ?', [
|
||||
$this->logger->warning(self::class.' could not retrieve event from ms graph. Already deleted ?', [
|
||||
'calendarId' => $calendar->getId(),
|
||||
'remoteEventId' => $notification['resource'],
|
||||
]);
|
||||
@@ -76,7 +73,7 @@ class CalendarSyncer
|
||||
);
|
||||
|
||||
if ($calendar->getRemoteAttributes()['lastModifiedDateTime'] === $lastModified->getTimestamp()) {
|
||||
$this->logger->info(self::class . ' change key is equals. Source is probably a local update', [
|
||||
$this->logger->info(self::class.' change key is equals. Source is probably a local update', [
|
||||
'calendarRangeId' => $calendar->getId(),
|
||||
'remoteEventId' => $notification['resource'],
|
||||
]);
|
||||
@@ -135,12 +132,12 @@ class CalendarSyncer
|
||||
'tentativelyAccepted' => $invite->setStatus(Invite::TENTATIVELY_ACCEPTED),
|
||||
'accepted' => $invite->setStatus(Invite::ACCEPTED),
|
||||
'declined' => $invite->setStatus(Invite::DECLINED),
|
||||
default => throw new LogicException('should not happens, not implemented: ' . $status),
|
||||
default => throw new \LogicException('should not happens, not implemented: '.$status),
|
||||
};
|
||||
}
|
||||
|
||||
foreach ($calendar->getUsers() as $user) {
|
||||
if (!in_array(strtolower($user->getEmailCanonical()), $emails, true)) {
|
||||
if (!\in_array(strtolower($user->getEmailCanonical()), $emails, true)) {
|
||||
$calendar->removeUser($user);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user