Initial commit

This commit is contained in:
armel committed 2026-06-05 23:40:26 +02:00
commit ebf977cf48
11 files changed
+3131

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Scandalous\Contract;
interface ProcessRunnerInterface
{
/** @param string[] $command */
public function run(array $command): string;
}
+10
View File
@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Scandalous\Contract;
interface TextExtractorInterface
{
public function extract(string $file): string;
}
+21
View File
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace Scandalous\Engine;
use Scandalous\Contract\ProcessRunnerInterface;
use Scandalous\Contract\TextExtractorInterface;
final class LiteParseExtractor implements TextExtractorInterface
{
public function __construct(
private ProcessRunnerInterface $runner,
private string $binary = 'lit',
) {}
public function extract(string $file): string
{
return $this->runner->run([$this->binary, 'parse', $file]);
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace Scandalous\Process;
use Scandalous\Contract\ProcessRunnerInterface;
use Symfony\Component\Process\Process;
final class ProcessRunner implements ProcessRunnerInterface
{
/** @param string[] $command */
public function run(array $command): string
{
$process = new Process($command);
$process->mustRun();
return $process->getOutput();
}
}
+19
View File
@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace Scandalous;
use Scandalous\Contract\TextExtractorInterface;
class Scandalous
{
public function __construct(
private readonly TextExtractorInterface $extractor,
) {}
public function extract(string $pdfPath): string
{
return $this->extractor->extract($pdfPath);
}
}