30 lines
626 B
PHP
30 lines
626 B
PHP
|
<?php
|
||
|
|
||
|
use IO\Filesystem\File;
|
||
|
use PDF\Document;
|
||
|
use PDF\Metadata;
|
||
|
|
||
|
trait ExampleDocumentAccess
|
||
|
{
|
||
|
protected function exampleDocument(?Metadata $metadata = null): Document
|
||
|
{
|
||
|
return new Document(
|
||
|
$this->exampleFile(),
|
||
|
$metadata ?? Metadata::empty()
|
||
|
);
|
||
|
}
|
||
|
|
||
|
protected function exampleDocumentWithMetadata(array $data): Document
|
||
|
{
|
||
|
return new Document(
|
||
|
$this->exampleFile(),
|
||
|
Metadata::fill($data)
|
||
|
);
|
||
|
}
|
||
|
|
||
|
protected function exampleFile(): File
|
||
|
{
|
||
|
return File::fromString(__DIR__ . '/resources/example.pdf');
|
||
|
}
|
||
|
}
|