4
* This file is part of Packagist.
6
* (c) Jordi Boggiano <j.boggiano@seld.be>
7
* Nils Adermann <naderman@naderman.de>
9
* For the full copyright and license information, please view the LICENSE
10
* file that was distributed with this source code.
13
namespace Packagist\WebBundle\DependencyInjection\Compiler;
15
use Symfony\Component\DependencyInjection\Reference;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
20
* Adds VCS repository providers to the main repository_provider service
22
* @author Jordi Boggiano <j.boggiano@seld.be>
24
class RepositoryPass implements CompilerPassInterface
26
public function process(ContainerBuilder $container)
28
if (!$container->hasDefinition('packagist.repository_provider')) {
32
$provider = $container->getDefinition('packagist.repository_provider');
35
foreach ($container->findTaggedServiceIds('packagist.repository_provider') as $id => $tags) {
36
$providers[$id] = isset($tags[0]['priority']) ? (int) $tags[0]['priority'] : 0;
41
foreach ($providers as $id => $priority) {
42
$provider->addMethodCall('addProvider', array(new Reference($id)));