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

Update NucleosDompdfExtension.php Extension Injection #553

Merged
merged 5 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DependencyInjection/NucleosDompdfExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

final class NucleosDompdfExtension extends Extension
{
Expand All @@ -27,7 +27,7 @@
$config = $this->processConfiguration($configuration, $configs);

$loader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.php');

Check warning on line 30 in src/DependencyInjection/NucleosDompdfExtension.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "MethodCallRemoval": @@ @@ $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $loader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); - $loader->load('services.php'); + $container->setParameter('nucleos_dompdf.options', $config['defaults']); } }

$container->setParameter('nucleos_dompdf.options', $config['defaults']);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Wrapper/DompdfWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

private ?EventDispatcherInterface $eventDispatcher;

public function __construct(DompdfFactoryInterface $dompdfFactory, EventDispatcherInterface $eventDispatcher = null)
public function __construct(DompdfFactoryInterface $dompdfFactory, ?EventDispatcherInterface $eventDispatcher = null)
{
$this->dompdfFactory = $dompdfFactory;
$this->eventDispatcher = $eventDispatcher;
Expand All @@ -41,7 +41,7 @@
$pdf = $this->dompdfFactory->create($options);
$pdf->loadHtml($html);

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_": @@ @@ { $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);
}
Expand All @@ -55,7 +55,7 @@
$pdf = $this->dompdfFactory->create($options);
$pdf->loadHtml($html);

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_": @@ @@ { $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);
}
Expand Down
Loading