Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow \SplFileInfo or \Stringable in "files" methods #96

Open
Jean-Beru opened this issue Jul 12, 2024 · 0 comments
Open

Allow \SplFileInfo or \Stringable in "files" methods #96

Jean-Beru opened this issue Jul 12, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@Jean-Beru
Copy link
Contributor

Jean-Beru commented Jul 12, 2024

It could be useful to allow \Stringable or \SplFileInfo in the xxxBuilder::files() method.

It will improve DX by sending \SplFileInfo returned by a processor (see #90) to the MergeBuilder for example:

$fileProcessor = new FileProcessor($this->filesystem, $this->directory);

// Generate parts
$part1 = $this->pdf->html()
    ->content('pdf/invoice/part1.html.twig')
    ->processor($fileProcessor)
    ->generate()
    ->process()
;
$part2 = $this->pdf->html()
    ->content('pdf/invoice/part2.html.twig')
    ->processor($fileProcessor)
    ->generate()
    ->process()
;

// Merge
$invoice = $this->pdf->merge()
    ->fileName('invoice.pdf')
    ->files($part1, $part2) // <-- HERE
    ->processor($fileProcessor)
    ->generate()
    ->process()
;
@Jean-Beru Jean-Beru changed the title Allow \SplFileInfo or \Stringable in files methods Allow \SplFileInfo or \Stringable in "files" methods Jul 12, 2024
@Jean-Beru Jean-Beru added the good first issue Good for newcomers label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant