|
0
|
1 |
<?php |
|
|
2 |
|
|
|
3 |
/* |
|
|
4 |
* This file is part of the Symfony framework. |
|
|
5 |
* |
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.com> |
|
|
7 |
* |
|
|
8 |
* This source file is subject to the MIT license that is bundled |
|
|
9 |
* with this source code in the file LICENSE. |
|
|
10 |
*/ |
|
|
11 |
|
|
|
12 |
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler; |
|
|
13 |
|
|
|
14 |
use Symfony\Component\DependencyInjection\Reference; |
|
|
15 |
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
|
16 |
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
|
|
17 |
|
|
|
18 |
/** |
|
|
19 |
* Adds services tagged as workers to the asset factory. |
|
|
20 |
* |
|
|
21 |
* @author Kris Wallsmith <kris@symfony.com> |
|
|
22 |
*/ |
|
|
23 |
class AssetFactoryPass implements CompilerPassInterface |
|
|
24 |
{ |
|
|
25 |
public function process(ContainerBuilder $container) |
|
|
26 |
{ |
|
|
27 |
if (!$container->hasDefinition('assetic.asset_factory')) { |
|
|
28 |
return; |
|
|
29 |
} |
|
|
30 |
|
|
|
31 |
$factory = $container->getDefinition('assetic.asset_factory'); |
|
|
32 |
foreach ($container->findTaggedServiceIds('assetic.factory_worker') as $id => $attr) { |
|
|
33 |
$factory->addMethodCall('addWorker', array(new Reference($id))); |
|
|
34 |
} |
|
|
35 |
} |
|
|
36 |
} |