20 lines
535 B
PHP
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.');
|
|
}
|
|
}
|
|
}
|