ldc-mesbr-app/src/Domain/Models/ValueObjects/Coupon/CouponLegalInformation.php

26 lines
686 B
PHP

<?php
declare(strict_types=1);
namespace Domain\Models\ValueObjects\Coupon;
use Domain\Models\ValueObjects\CountryAuthorized;
use Shared\DDD\Models\Equatable;
final readonly class CouponLegalInformation implements Equatable
{
public function __construct(
public string $legalText,
public CountryAuthorized $forLocale
) {
if (mb_trim($this->legalText) === '') {
throw new \DomainException('Legal text cannot be empty.');
}
}
#[\Override]
public function equals(mixed $other): bool
{
return $other instanceof self && $this->legalText === $other->legalText && $this->forLocale === $other->forLocale;
}
}