Yaffs site version 1.1
[yaffs-website] / vendor / symfony / http-kernel / DependencyInjection / AddClassesToCachePass.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\HttpKernel\DependencyInjection;
13
14 use Symfony\Component\DependencyInjection\ContainerBuilder;
15 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16 use Symfony\Component\HttpKernel\Kernel;
17
18 /**
19  * Sets the classes to compile in the cache for the container.
20  *
21  * @author Fabien Potencier <fabien@symfony.com>
22  */
23 class AddClassesToCachePass implements CompilerPassInterface
24 {
25     private $kernel;
26
27     public function __construct(Kernel $kernel)
28     {
29         $this->kernel = $kernel;
30     }
31
32     /**
33      * {@inheritdoc}
34      */
35     public function process(ContainerBuilder $container)
36     {
37         $classes = array();
38         foreach ($container->getExtensions() as $extension) {
39             if ($extension instanceof Extension) {
40                 $classes = array_merge($classes, $extension->getClassesToCompile());
41             }
42         }
43
44         $this->kernel->setClassCache(array_unique($container->getParameterBag()->resolveValue($classes)));
45     }
46 }