Completed
Push — 2.x ( 5969b2...2b7d1f )
by Grégoire
15:29
created

ServiceCompilerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 15 2
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
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 Sonata\SeoBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
17
/**
18
 * @author Christian Gripp <[email protected]>
19
 */
20
final class ServiceCompilerPass implements CompilerPassInterface
21
{
22
    public function process(ContainerBuilder $container)
23
    {
24
        $config = $container->getParameter('sonata.seo.config');
25
26
        $definition = $container->findDefinition($config['default']);
27
28
        $definition->addMethodCall('setTitle', [$config['title']]);
29
        $definition->addMethodCall('setMetas', [$config['metas']]);
30
        $definition->addMethodCall('setHtmlAttributes', [$config['head']]);
31
        $definition->addMethodCall('setSeparator', [$config['separator']]);
32
33
        if ($alias = $container->setAlias('sonata.seo.page', $config['default'])) {
34
            $alias->setPublic(true);
35
        }
36
    }
37
}
38