ldc-mesbr-app/src/Domain/Models/ValueObjects/Coupon/CouponName.php
2026-10-12 17:07:56 +02:00

22 lines
485 B
PHP

<?php
declare(strict_types=1);
namespace Domain\Models\ValueObjects\Coupon;
final readonly class CouponName
{
public function __construct(
public string $value,
) {
$trimmed = mb_trim($value);
if ($trimmed === '') {
throw new \DomainException('Coupon name cannot be empty.');
}
if (mb_strlen($trimmed) > 200) {
throw new \DomainException('Coupon name exceeds the maximum allowed length.');
}
}
}