/** * @param string $value * * @throws \InvalidArgumentException */ public function __construct($value = null) { if ($value !== null && !self::isValidUUID($value)) { throw new \InvalidArgumentException(sprintf('Argument "%s" is an invalid UUID.', $value)); } parent::__construct($value === null ? self::nextUUIDValue() : $value); }
public function isEqual(StringId $stringId) { return $this->stringId == $stringId->__toString(); }