25 lines
518 B
PHP
25 lines
518 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Domain\Models\ValueObjects;
|
|
|
|
use Ramsey\Uuid\UuidInterface;
|
|
use Shared\Helpers\UuidHelper;
|
|
|
|
final readonly class OrderReference implements \Stringable
|
|
{
|
|
public function __construct(
|
|
public UuidInterface $value
|
|
) {
|
|
if (! UuidHelper::isV7($value)) {
|
|
throw new \DomainException('value must be a valid UUID v7');
|
|
}
|
|
}
|
|
|
|
#[\Override]
|
|
public function __toString(): string
|
|
{
|
|
return $this->value->toString();
|
|
}
|
|
}
|