ldc-boutique-cnc-sable/domain/Models/ValueObjects/ImportRowResult.php
2026-10-27 09:58:12 +01:00

29 lines
594 B
PHP

<?php
declare(strict_types=1);
namespace Domain\Models\ValueObjects;
/**
* @template T
*/
final readonly class ImportRowResult
{
/**
* @param T|null $mappedResult
*/
public function __construct(
public int $lineNumber,
public mixed $mappedResult = null,
public ?string $error = null
) {
if ($lineNumber <= 0) {
throw new \DomainException('Line number must be a positive integer.');
}
}
public function isSuccess(): bool
{
return $this->mappedResult !== null && $this->error === null;
}
}