ldc-cocotte/domain/Models/ValueObjects/ImportRowResult.php

30 lines
594 B
PHP
Raw Normal View History

2026-06-14 21:32:07 +02:00
<?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;
}
}