ldc-boutique-cnc-sable/domain/Models/ValueObjects/CsvImportFile.php

21 lines
535 B
PHP
Raw Normal View History

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