ldc-mesbr-app/src/Domain/Models/ValueObjects/ProcessingCode.php

30 lines
626 B
PHP
Raw Normal View History

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