src/DependencyInjection/Compiler/AddProviderCompilerPass.php
public function applyFormats(ContainerBuilder $container, array $settings)
    {
        foreach ($settings['contexts'] as $name => $context) {
            // add the different related formats
            foreach ($context['providers'] as $id) {
                $definition = $container->getDefinition($id);

                foreach ($context['formats'] as $format => $config) {
                    $config['quality'] = $config['quality'] ?? 80;
                    $config['format'] = $config['format'] ?? 'jpg';
                    $config['height'] = $config['height'] ?? null;
                    $config['constraint'] = $config['constraint'] ?? true;
                    $config['resizer'] = $config['resizer'] ?? false;

                    $formatName = sprintf('%s_%s', $name, $format);
                    $definition->addMethodCall('addFormat', [$formatName, $config]);
                }
            }
        }
    }
public function applyFormats(ContainerBuilder $container, array $settings)
    {
        foreach ($settings['contexts'] as $name => $context) {
            // add the different related formats
            foreach ($context['providers'] as $id) {
                $definition = $container->getDefinition($id);

                foreach ($context['formats'] as $format => $config) {
                    $config['quality'] = $config['quality'] ?? 80;
                    $config['format'] = $config['format'] ?? 'jpg';
                    $config['height'] = $config['height'] ?? null;
                    $config['constraint'] = $config['constraint'] ?? true;
                    $config['resizer'] = $config['resizer'] ?? false;

                    $formatName = sprintf('%s_%s', $name, $format);
                    $definition->addMethodCall('addFormat', [$formatName, $config]);
                }
            }
        }
    }
public function applyFormats ( ContainerBuilder $ container , array $ settings ) { foreach ( $ settings [ 'contexts' ] as $ name => $ context ) { // add the different related formats foreach ( $ context [ 'providers' ] as $ id ) { $ definition = $ container -> getDefinition ( $ id ) ; foreach ( $ context [ 'formats' ] as $ format => $ config ) { $ config [ 'quality' ] = $ config [ 'quality' ] ?? 80 ; $ config [ 'format' ] = $ config [ 'format' ] ?? 'jpg' ; $ config [ 'height' ] = $ config [ 'height' ] ?? null ; $ config [ 'constraint' ] = $ config [ 'constraint' ] ?? true ; $ config [ 'resizer' ] = $ config [ 'resizer' ] ?? false ; $ formatName = sprintf ( '%s_%s' , $ name , $ format ) ; $ definition -> addMethodCall ( 'addFormat' , [ $ formatName , $ config ] ) ; } } } }
Define the default settings to the config array.

@param ContainerBuilder $container
@param array            $settings
Define the default settings to the config array .