mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 01:03:13 +08:00
Defined enum with supported remote systems
This commit is contained in:
@@ -8,5 +8,5 @@ abstract class AbstractAsyncListener
|
||||
{
|
||||
abstract protected function isEnabled(): bool;
|
||||
|
||||
abstract protected function getRemoteSystemName(): string;
|
||||
abstract protected function getRemoteSystem(): RemoteSystem;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ abstract class AbstractNotifyNewShortUrlListener extends AbstractAsyncListener
|
||||
|
||||
$shortUrlId = $shortUrlCreated->shortUrlId;
|
||||
$shortUrl = $this->em->find(ShortUrl::class, $shortUrlId);
|
||||
$name = $this->getRemoteSystemName();
|
||||
$name = $this->getRemoteSystem()->value;
|
||||
|
||||
if ($shortUrl === null) {
|
||||
$this->logger->warning(
|
||||
|
||||
@@ -33,7 +33,7 @@ abstract class AbstractNotifyVisitListener extends AbstractAsyncListener
|
||||
|
||||
$visitId = $visitLocated->visitId;
|
||||
$visit = $this->em->find(Visit::class, $visitId);
|
||||
$name = $this->getRemoteSystemName();
|
||||
$name = $this->getRemoteSystem()->value;
|
||||
|
||||
if ($visit === null) {
|
||||
$this->logger->warning(
|
||||
|
||||
12
module/Core/src/EventDispatcher/Async/RemoteSystem.php
Normal file
12
module/Core/src/EventDispatcher/Async/RemoteSystem.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\EventDispatcher\Async;
|
||||
|
||||
enum RemoteSystem: string
|
||||
{
|
||||
case MERCURE = 'Mercure';
|
||||
case RABBIT_MQ = 'RabbitMQ';
|
||||
case REDIS_PUB_SUB = 'Redis pub/sub';
|
||||
}
|
||||
Reference in New Issue
Block a user