Completed
Push — master ( 2c3ffa...a85393 )
by Asmir
28:06
created

SoapClientExtension::prepend()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
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\Extension\PrependExtensionInterface;
8
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
9
10
class SoapClientExtension extends Extension implements PrependExtensionInterface
11
{
12
    public function load(array $configs, ContainerBuilder $container)
13
    {
14
        $config = $this->processConfiguration(new Configuration(), $configs);
15
        foreach ($configs as $subConfig) {
16
            $config = array_merge($config, $subConfig);
17
        }
18
        $container->setParameter('goetas_webservices.soap_client.config', $config);
19
        $container->setParameter('goetas_webservices.soap_client.unwrap_returns', $config['unwrap_returns']);
20
21
        $xml = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
22
        $xml->load('services.xml');
23
    }
24
25
    protected static function sanitizePhp($ns)
26
    {
27
        return strtr($ns, '/', '\\');
28
    }
29
30
    public function getAlias()
31
    {
32
        return 'soap_client';
33
    }
34
35
    /**
36
     * Allow an extension to prepend the extension configurations.
37
     *
38
     * @param ContainerBuilder $container
39
     */
40
    public function prepend(ContainerBuilder $container)
41
    {
42
        $container->prependExtensionConfig('goetas_soap_common', []);
43
    }
44
}
45