Completed
Push — master ( 030796...0c67b5 )
by Asmir
30:13
created

SoapClientExtension   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 5
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 12 2
A sanitizePhp() 0 4 1
A getAlias() 0 4 1
1
<?php
2
namespace GoetasWebservices\SoapServices\SoapClient\DependencyInjection;
3
4
use Symfony\Component\Config\FileLocator;
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Extension\Extension;
7
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
8
9
class SoapClientExtension extends Extension
10
{
11
    public function load(array $configs, ContainerBuilder $container)
12
    {
13
        $config = $this->processConfiguration(new Configuration(), $configs);
14
        foreach ($configs as $subConfig) {
15
            $config = array_merge($config, $subConfig);
16
        }
17
        $container->setParameter('goetas.soap_client.config', $config);
18
        $container->setParameter('goetas.soap_client.unwrap_returns', $config['unwrap_returns']);
19
20
        $xml = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
21
        $xml->load('services.xml');
22
    }
23
24
    protected static function sanitizePhp($ns)
25
    {
26
        return strtr($ns, '/', '\\');
27
    }
28
29
    public function getAlias()
30
    {
31
        return 'soap_client';
32
    }
33
}
34