Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
check:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -15,7 +15,7 @@ jobs:
- name: Validate composer.json
run: composer validate --strict --no-check-lock
tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand Down
27 changes: 27 additions & 0 deletions config/image.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->defaults()
->public()
->autowire();

$services->set(Knp\Snappy\Image::class)
->args([
"%knp_snappy.image.binary%",
"%knp_snappy.image.options%",
"%knp_snappy.image.env%",
]
)
->call('setLogger', [service('logger')])
->tag('monolog.setLogger', ['channel' => 'snappy'])
->public()
->alias('knp_snappy.image', Knp\Snappy\Image::class)
;
};
19 changes: 0 additions & 19 deletions config/image.xml

This file was deleted.

27 changes: 27 additions & 0 deletions config/pdf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->defaults()
->public()
->autowire();

$services->set(Knp\Snappy\Pdf::class)
->args([
"%knp_snappy.pdf.binary%",
"%knp_snappy.pdf.options%",
"%knp_snappy.pdf.env%",
]
)
->call('setLogger', [service('logger')])
->tag('monolog.setLogger', ['channel' => 'snappy'])
->public()
->alias('knp_snappy.pdf', Knp\Snappy\Pdf::class)
;
};
19 changes: 0 additions & 19 deletions config/pdf.xml

This file was deleted.

8 changes: 4 additions & 4 deletions src/DependencyInjection/KnpSnappyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;

class KnpSnappyExtension extends Extension
{
Expand All @@ -15,14 +15,14 @@ class KnpSnappyExtension extends Extension
*/
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader = new PHPFileLoader($container, new FileLocator(__DIR__ . '/../../config'));

$configuration = new Configuration();
$processor = new Processor();
$config = $processor->processConfiguration($configuration, $configs);

if ($config['pdf']['enabled']) {
$loader->load('pdf.xml');
$loader->load('pdf.php');

$container->setParameter('knp_snappy.pdf.binary', $config['pdf']['binary']);
$container->setParameter('knp_snappy.pdf.options', $config['pdf']['options']);
Expand All @@ -39,7 +39,7 @@ public function load(array $configs, ContainerBuilder $container): void
}

if ($config['image']['enabled']) {
$loader->load('image.xml');
$loader->load('image.php');

$container->setParameter('knp_snappy.image.binary', $config['image']['binary']);
$container->setParameter('knp_snappy.image.options', $config['image']['options']);
Expand Down