OdeskPhystrixExtension::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 8
nc 1
nop 2
1
<?php
2
3
/**
4
 * This file is a part of the Phystrix Bundle.
5
 *
6
 * Copyright 2013-2015 oDesk Corporation. All Rights Reserved.
7
 *
8
 * This file is licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
namespace Odesk\Bundle\PhystrixBundle\DependencyInjection;
21
22
use Symfony\Component\Config\FileLocator;
23
use Symfony\Component\DependencyInjection\ContainerBuilder;
24
use Symfony\Component\DependencyInjection\Extension\Extension;
25
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
26
27
/**
28
 * Class OdeskPhystrixExtension configures phystrix services.
29
 */
30
class OdeskPhystrixExtension extends Extension
31
{
32
    public function load(array $configs, ContainerBuilder $container)
33
    {
34
        $configuration = new Configuration();
35
        $config = $this->processConfiguration($configuration, $configs);
36
37
        $loader = new YamlFileLoader(
38
            $container,
39
            new FileLocator(__DIR__.'/../Resources/config')
40
        );
41
        $loader->load('config.yml');
42
43
        $container->setParameter('phystrix.configuration.data', $config);
44
    }
45
}
46