Completed
Push — master ( 9d25fd...d01ec4 )
by
unknown
02:54
created

ServiceCompilerPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\SeoBundle\DependencyInjection\Compiler;
15
16
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
19
/**
20
 * @author Christian Gripp <[email protected]>
21
 */
22
final class ServiceCompilerPass implements CompilerPassInterface
23
{
24
    public function process(ContainerBuilder $container): void
25
    {
26
        $config = $container->getParameter('sonata.seo.config');
27
28
        $definition = $container->findDefinition($config['default']);
29
30
        $definition->addMethodCall('setTitle', [$config['title']]);
31
        $definition->addMethodCall('setMetas', [$config['metas']]);
32
        $definition->addMethodCall('setHtmlAttributes', [$config['head']]);
33
        $definition->addMethodCall('setSeparator', [$config['separator']]);
34
35
        if ($alias = $container->setAlias('sonata.seo.page', $config['default'])) {
36
            $alias->setPublic(true);
37
        }
38
    }
39
}
40