diff --git a/src/Domain/Contracts/Identifier.php b/src/Domain/Contracts/Identifier.php index 73ba2e4..02f9286 100644 --- a/src/Domain/Contracts/Identifier.php +++ b/src/Domain/Contracts/Identifier.php @@ -20,4 +20,13 @@ interface Identifier * @return string */ public function value(): string; + + /** + * Check if the given identifier is the same than the current one. + * + * @param Identifier $other + * + * @return bool + */ + public function is(Identifier $other): bool; } diff --git a/src/Domain/ValueObjects/UUIDValue.php b/src/Domain/ValueObjects/UUIDValue.php index 72a9fe3..91b1a98 100644 --- a/src/Domain/ValueObjects/UUIDValue.php +++ b/src/Domain/ValueObjects/UUIDValue.php @@ -72,6 +72,18 @@ public static function random(): self return new static(self::RANDOM); } + /** + * Check if the given identifier is the same than the current one. + * + * @param Identifier $other + * + * @return bool + */ + public function is(Identifier $other): bool + { + return $this->equals($other); + } + /** * To string method. *