feat: add ProcessImportMessageHandler
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user