Separation of concerns

This commit is contained in:
2021-04-08 15:36:57 +02:00
parent cc2696668c
commit afff03166e
15 changed files with 155 additions and 96 deletions

View File

@@ -3,7 +3,7 @@
use IO\ExceptionHandler;
use IO\Input\FinderArguments;
use IO\Output\DocumentListingOutput;
use IO\Output\DocumentListing;
use PDF\Document;
require_once __DIR__ . '/../vendor/autoload.php';
@@ -23,4 +23,4 @@ foreach ($filters as $filter) {
$documents = $documents->filter(fn(Document $document) => $filter->allows($document));
}
DocumentListingOutput::forDocuments($documents)->render();
DocumentListing::of($documents)->render();

View File

@@ -3,17 +3,12 @@
use IO\ExceptionHandler;
use IO\Input\ShowInfoArguments;
use IO\Output\DocumentOutput;
use IO\Output\DocumentDetails;
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();
$file = ShowInfoArguments::createFromGlobals()->getFile();
$document = DocumentFactory::create()->fromFile($file);
DocumentDetails::of($document)->render();