Initial commit

This commit is contained in:
2021-03-23 21:58:40 +01:00
commit 61623f5a35
30 changed files with 1936 additions and 0 deletions

26
bin/pdf-finder.php Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
use IO\ExceptionHandler;
use IO\Input\FinderArguments;
use IO\Output\DocumentListingOutput;
use PDF\Document;
require_once __DIR__ . '/../vendor/autoload.php';
ExceptionHandler::registerCallback();
$arguments = FinderArguments::createFromGlobals();
$directory = $arguments->getDirectory();
$filters = $arguments->getFilters();
printf('Scanning "%s"...%s', $directory, PHP_EOL);
$locator = new RecursiveDocumentLocator();
$documents = $locator->findDocuments($directory);
foreach ($filters as $filter) {
printf('Applying filter { %s }...%s', $filter, PHP_EOL);
$documents = $documents->filter(fn(Document $document) => $filter->allows($document));
}
DocumentListingOutput::forDocuments($documents)->render();

19
bin/pdf-show-info.php Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
use IO\ExceptionHandler;
use IO\Input\ShowInfoArguments;
use IO\Output\DocumentOutput;
require_once __DIR__ . '/../vendor/autoload.php';
ExceptionHandler::registerCallback();
$arguments = ShowInfoArguments::createFromGlobals();
$file = $arguments->getFile();
$documentFactory = DocumentFactory::create();
$document = $documentFactory->createDocument($file);
$output = DocumentOutput::forDocument($document);
$output->render();