ldc-mesbr-app/src/Domain/Models/ValueObjects/Coupon/CouponProductInfo.php
2026-09-22 11:31:04 +02:00

34 lines
863 B
PHP

<?php
declare(strict_types=1);
namespace Domain\Models\ValueObjects\Coupon;
use Domain\Enums\Country;
use Shared\DDD\Models\Equatable;
final readonly class CouponProductInfo implements Equatable
{
public function __construct(
public string $name,
public string $range,
public string $validityText,
public Country $forLocale
) {
$trimmed = trim($this->name);
if ($trimmed === '') {
throw new \DomainException('Product Info name cannot be empty.');
}
}
#[\Override]
public function equals(mixed $other): bool
{
return $other instanceof self
&& $this->name === $other->name
&& $this->range === $other->range
&& $this->validityText === $other->validityText
&& $this->forLocale->equals($other->forLocale);
}
}