Skip to content

Commit

Permalink
Add static factory for existing files
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrank authored May 24, 2024
1 parent 7a5a8b7 commit 07adeac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ZugferdDocumentPdfBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ class ZugferdDocumentPdfBuilder extends ZugferdDocumentPdfBuilderAbstract
*/
private $xmlDataCache = "";

/**
* @see self::__construct
*/
public static function fromPdfFile(ZugferdDocumentBuilder $documentBuilder, string $pdfData): self
{
if (!is_file($pdfData)) {
throw new \InvalidArgumentException("The given PDF file does not exist.");
}
return new self($documentBuilder, $pdfData);
}

/**
* Constructor
*
Expand Down

0 comments on commit 07adeac

Please sign in to comment.