| @@ 5-34 (lines=30) @@ | ||
| 2 | ||
| 3 | namespace Carnage\EncryptedColumn\ValueObject; |
|
| 4 | ||
| 5 | class EncryptorIdentity implements IdentityInterface |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @var string |
|
| 9 | */ |
|
| 10 | private $identity; |
|
| 11 | ||
| 12 | public function __construct(string $identity) |
|
| 13 | { |
|
| 14 | $this->identity = $identity; |
|
| 15 | } |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @return string |
|
| 19 | */ |
|
| 20 | public function getIdentity(): string |
|
| 21 | { |
|
| 22 | return $this->identity; |
|
| 23 | } |
|
| 24 | ||
| 25 | public function toString(): string |
|
| 26 | { |
|
| 27 | return $this->identity; |
|
| 28 | } |
|
| 29 | ||
| 30 | public function equals(IdentityInterface $other): bool |
|
| 31 | { |
|
| 32 | return $other instanceof EncryptorIdentity && $this->identity === $other->identity; |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| @@ 5-34 (lines=30) @@ | ||
| 2 | ||
| 3 | namespace Carnage\EncryptedColumn\ValueObject; |
|
| 4 | ||
| 5 | class SerializerIdentity implements IdentityInterface |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @var string |
|
| 9 | */ |
|
| 10 | private $identity; |
|
| 11 | ||
| 12 | public function __construct(string $identity) |
|
| 13 | { |
|
| 14 | $this->identity = $identity; |
|
| 15 | } |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @return string |
|
| 19 | */ |
|
| 20 | public function getIdentity(): string |
|
| 21 | { |
|
| 22 | return $this->identity; |
|
| 23 | } |
|
| 24 | ||
| 25 | public function toString(): string |
|
| 26 | { |
|
| 27 | return $this->identity; |
|
| 28 | } |
|
| 29 | ||
| 30 | public function equals(IdentityInterface $other): bool |
|
| 31 | { |
|
| 32 | return $other instanceof SerializerIdentity && $this->identity === $other->identity; |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| @@ 5-34 (lines=30) @@ | ||
| 2 | ||
| 3 | namespace Carnage\EncryptedColumn\ValueObject; |
|
| 4 | ||
| 5 | class KeyIdentity implements IdentityInterface |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @var string |
|
| 9 | */ |
|
| 10 | private $identity; |
|
| 11 | ||
| 12 | public function __construct(string $identity) |
|
| 13 | { |
|
| 14 | $this->identity = $identity; |
|
| 15 | } |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @return string |
|
| 19 | */ |
|
| 20 | public function getIdentity(): string |
|
| 21 | { |
|
| 22 | return $this->identity; |
|
| 23 | } |
|
| 24 | ||
| 25 | public function toString(): string |
|
| 26 | { |
|
| 27 | return $this->identity; |
|
| 28 | } |
|
| 29 | ||
| 30 | public function equals(IdentityInterface $other): bool |
|
| 31 | { |
|
| 32 | return $other instanceof KeyIdentity && $this->identity === $other->identity; |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||