-
Notifications
You must be signed in to change notification settings - Fork 0
/
PreviewPortalNodeKey.php
42 lines (33 loc) · 1.03 KB
/
PreviewPortalNodeKey.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
declare(strict_types=1);
namespace Heptacom\HeptaConnect\Storage\Base;
use Heptacom\HeptaConnect\Portal\Base\Portal\PortalType;
use Heptacom\HeptaConnect\Portal\Base\StorageKey\Contract\PortalNodeKeyInterface;
use Heptacom\HeptaConnect\Portal\Base\StorageKey\Contract\StorageKeyInterface;
final class PreviewPortalNodeKey implements PortalNodeKeyInterface
{
public function __construct(
private PortalType $portalType
) {
}
public function getPortalType(): PortalType
{
return $this->portalType;
}
public function equals(StorageKeyInterface $other): bool
{
return $other === $this || ($other instanceof PreviewPortalNodeKey && $other->getPortalType()->equals($this->getPortalType()));
}
public function jsonSerialize(): array
{
return ['preview' => $this->portalType];
}
public function withAlias(): PortalNodeKeyInterface
{
return $this;
}
public function withoutAlias(): PortalNodeKeyInterface
{
return $this;
}
}