Initial commit
This commit is contained in:
25
src/DocumentFactory.php
Normal file
25
src/DocumentFactory.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use IO\Shell\Pdfinfo;
|
||||
use PDF\Document;
|
||||
|
||||
class DocumentFactory
|
||||
{
|
||||
private Pdfinfo $pdfinfo;
|
||||
|
||||
public function __construct(?Pdfinfo $pdfinfo = null)
|
||||
{
|
||||
$this->pdfinfo = $pdfinfo ?? new Pdfinfo();
|
||||
}
|
||||
|
||||
public static function create(): self
|
||||
{
|
||||
return new self();
|
||||
}
|
||||
|
||||
public function createDocument(SplFileInfo $file): Document
|
||||
{
|
||||
$metadata = $this->pdfinfo->getMetadata($file);
|
||||
return new Document($file, $metadata);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user