mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 17:44:44 +08:00
Moved event objects to a sub-namespace inside Core\EventDispatcher
This commit is contained in:
27
module/Core/src/EventDispatcher/Event/AbstractVisitEvent.php
Normal file
27
module/Core/src/EventDispatcher/Event/AbstractVisitEvent.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\EventDispatcher\Event;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
abstract class AbstractVisitEvent implements JsonSerializable
|
||||
{
|
||||
protected string $visitId;
|
||||
|
||||
public function __construct(string $visitId)
|
||||
{
|
||||
$this->visitId = $visitId;
|
||||
}
|
||||
|
||||
public function visitId(): string
|
||||
{
|
||||
return $this->visitId;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return ['visitId' => $this->visitId];
|
||||
}
|
||||
}
|
||||
@@ -2,33 +2,20 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\EventDispatcher;
|
||||
namespace Shlinkio\Shlink\Core\EventDispatcher\Event;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
final class ShortUrlVisited implements JsonSerializable
|
||||
final class ShortUrlVisited extends AbstractVisitEvent
|
||||
{
|
||||
private string $visitId;
|
||||
private ?string $originalIpAddress;
|
||||
|
||||
public function __construct(string $visitId, ?string $originalIpAddress = null)
|
||||
{
|
||||
$this->visitId = $visitId;
|
||||
parent::__construct($visitId);
|
||||
$this->originalIpAddress = $originalIpAddress;
|
||||
}
|
||||
|
||||
public function visitId(): string
|
||||
{
|
||||
return $this->visitId;
|
||||
}
|
||||
|
||||
public function originalIpAddress(): ?string
|
||||
{
|
||||
return $this->originalIpAddress;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return ['visitId' => $this->visitId, 'originalIpAddress' => '<censored>'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,26 +2,8 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\EventDispatcher;
|
||||
namespace Shlinkio\Shlink\Core\EventDispatcher\Event;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
final class VisitLocated implements JsonSerializable
|
||||
final class VisitLocated extends AbstractVisitEvent
|
||||
{
|
||||
private string $visitId;
|
||||
|
||||
public function __construct(string $visitId)
|
||||
{
|
||||
$this->visitId = $visitId;
|
||||
}
|
||||
|
||||
public function visitId(): string
|
||||
{
|
||||
return $this->visitId;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return ['visitId' => $this->visitId];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user