- Added UnsubscribeFromNewsletter action and input/output classes. - Introduced CrmHashcode value object and its cast. - Updated NewsletterController to use the new unsubscribe action. - Enhanced validation in UnsubscribeNewsletterRequest.
29 lines
590 B
PHP
29 lines
590 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Shared\ValueObjects;
|
|
|
|
use Ramsey\Uuid\UuidInterface;
|
|
use Shared\Helpers\UuidHelper;
|
|
|
|
final readonly class CrmHashcode implements \Stringable
|
|
{
|
|
public string $value;
|
|
|
|
public function __construct(
|
|
UuidInterface $value,
|
|
) {
|
|
UuidHelper::validateUuid($value);
|
|
|
|
if (! UuidHelper::isV4($value)) {
|
|
throw new \DomainException('CrmHashcode is not a valid uuidv4');
|
|
}
|
|
$this->value = $value->toString();
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return $this->value;
|
|
}
|
|
}
|