Passed
Branch master (bdaefa)
by Gary
08:54
created

GhoubreFirebaseServiceExtension::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 2
dl 0
loc 13
ccs 0
cts 13
cp 0
crap 2
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Firebase Service Bundle.
5
 *
6
 * (c) Gary HOUBRE <[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 Ghoubre\FirebaseServiceBundle\DependencyInjection;
13
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\DependencyInjection\Extension\Extension;
16
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
17
use Symfony\Component\Config\FileLocator;
18
19
class GhoubreFirebaseServiceExtension extends Extension
20
{
21
    public function load(array $configs, ContainerBuilder $container)
22
    {
23
        $loader = new XmlFileLoader(
24
            $container,
25
            new FileLocator(__DIR__.'/../Resources/config')
26
        );
27
        $loader->load('services.xml');
28
        $configuration = new Configuration();
29
        $config = $this->processConfiguration($configuration, $configs);
30
        $definition = $container->getDefinition('ghoubre.firebase_notification_service');
31
        $definition->replaceArgument(0, $config['serverKey']);
32
        $definition->replaceArgument(1, $config['content_available']);
33
        $definition->replaceArgument(2, $config['time_to_live']);
34
    }
35
}
36