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 the use of callback in events #544

Merged
merged 1 commit into from Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Wrapper/DompdfWrapper.php
Expand Up @@ -40,27 +40,27 @@
{
$pdf = $this->dompdfFactory->create($options);
$pdf->loadHtml($html);
$pdf->render();

if ($this->eventDispatcher instanceof EventDispatcherInterface) {

Check warning on line 44 in src/Wrapper/DompdfWrapper.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ { $pdf = $this->dompdfFactory->create($options); $pdf->loadHtml($html); - if ($this->eventDispatcher instanceof EventDispatcherInterface) { + if (true) { $event = new StreamEvent($pdf, $filename, $html); $this->eventDispatcher->dispatch($event, DompdfEvents::STREAM); }
$event = new StreamEvent($pdf, $filename, $html);
$this->eventDispatcher->dispatch($event, DompdfEvents::STREAM);
}

$pdf->render();
$pdf->stream($filename, $options);
}

public function getPdf(string $html, array $options = []): string
{
$pdf = $this->dompdfFactory->create($options);
$pdf->loadHtml($html);
$pdf->render();

if ($this->eventDispatcher instanceof EventDispatcherInterface) {

Check warning on line 58 in src/Wrapper/DompdfWrapper.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ { $pdf = $this->dompdfFactory->create($options); $pdf->loadHtml($html); - if ($this->eventDispatcher instanceof EventDispatcherInterface) { + if (true) { $event = new OutputEvent($pdf, $html); $this->eventDispatcher->dispatch($event, DompdfEvents::OUTPUT); }
$event = new OutputEvent($pdf, $html);
$this->eventDispatcher->dispatch($event, DompdfEvents::OUTPUT);
}

$pdf->render();
$out = $pdf->output();

if (null === $out) {
Expand Down