Completed
Pull Request — master (#1)
by Artem
01:44
created

FreshSinchExtension::getAlias()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/*
3
 * This file is part of the FreshSinchBundle
4
 *
5
 * (c) Artem Henvald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Fresh\SinchBundle\DependencyInjection;
12
13
use Symfony\Component\Config\FileLocator;
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
16
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
17
18
/**
19
 * FreshSinchExtension.
20
 *
21
 * @author Artem Henvald <[email protected]>
22
 */
23
class FreshSinchExtension extends Extension
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function load(array $configs, ContainerBuilder $container)
29
    {
30
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
31
        $loader->load('services.yml');
32
33
        $configuration = new Configuration();
34
        $config = $this->processConfiguration($configuration, $configs);
35
36
        $container->setParameter('sinch.host', $config['host']);
37
        $container->setParameter('sinch.key', $config['key']);
38
        $container->setParameter('sinch.secret', $config['secret']);
39
        $container->setParameter('sinch.from', $config['from']);
40
    }
41
}
42