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

20 lines
535 B
PHP

<?php
declare(strict_types=1);
namespace Domain\Models\ValueObjects;
final readonly class CsvImportFile
{
public function __construct(
public string $realPath,
public string $fileContent
) {
if (is_file($realPath) === false || is_readable($realPath) === false) {
throw new \DomainException("The file at path '{$realPath}' is not readable.");
}
if (trim($fileContent) === '') {
throw new \DomainException('The file content cannot be empty.');
}
}
}