This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddClassesToCachePass.php

40 lines
1.1 KiB
PHP
Raw Normal View History

<?php
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
2011-01-27 13:14:15 +00:00
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* Sets the classes to compile in the cache for the container.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class AddClassesToCachePass implements CompilerPassInterface
{
/**
* {@inheritDoc}
*/
public function process(ContainerBuilder $container)
{
$classes = array();
foreach ($container->getExtensions() as $extension) {
2011-01-27 13:14:15 +00:00
if ($extension instanceof Extension) {
$classes = array_merge($classes, $extension->getClassesToCompile());
}
}
$container->setParameter('kernel.compiled_classes', array_unique($classes));
}
}