feat: add ProcessImportMessageHandler

This commit is contained in:
thibaud-leclere
2026-03-29 10:19:31 +02:00
parent 2d768e8b52
commit 98be393e3c
2 changed files with 96 additions and 4 deletions

View File

@@ -20,13 +20,13 @@ readonly class LtbxdGateway
* @return LtbxdMovie[]
* @throws GatewayException
*/
public function parseFile(): array
public function parseFileFromPath(string $path): array
{
if (!file_exists($this->fileDir)) {
throw new GatewayException(sprintf('Could not find file %s', $this->fileDir));
if (!file_exists($path)) {
throw new GatewayException(sprintf('Could not find file %s', $path));
}
$fileContent = file_get_contents($this->fileDir);
$fileContent = file_get_contents($path);
try {
return $this->serializer->deserialize($fileContent, LtbxdMovie::class.'[]', 'csv');
@@ -34,4 +34,13 @@ readonly class LtbxdGateway
throw new GatewayException('Error while deserializing Letterboxd data', previous: $e);
}
}
/**
* @return LtbxdMovie[]
* @throws GatewayException
*/
public function parseFile(): array
{
return $this->parseFileFromPath($this->fileDir);
}
}