for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the BenGorFile package.
*
* (c) Beñat Espiña <[email protected]>
* (c) Gorka Laucirica <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace BenGorFile\FileBundle\DependencyInjection\Compiler;
use BenGorFile\FileBundle\Twig\DownloadExtension;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
/**
* Register Twig extensions compiler pass.
* Service declaration via PHP allows
* more flexibility with easy customization.
* @author Beñat Espiña <[email protected]>
class TwigPass implements CompilerPassInterface
{
* {@inheritdoc}
public function process(ContainerBuilder $container)
$config = $container->getParameter('bengor_file.config');
foreach ($config['file_class'] as $key => $file) {
$container->setDefinition(
'bengor_file.file_bundle.twig.view_extension_' . $key,
(new Definition(
DownloadExtension::class, [
$container->getDefinition('router'),
$key,
]
))->setPublic(false)
);
}