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
|
|
|
|