Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
14 | public function load(array $configs, ContainerBuilder $container) |
||
15 | { |
||
16 | $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
||
17 | $loader->load('guzzle.xml'); |
||
18 | $loader->load('services.xml'); |
||
19 | |||
20 | $configuration = new Configuration(); |
||
21 | $config = $this->processConfiguration($configuration, $configs); |
||
22 | |||
23 | $providers = $config['providers']; |
||
24 | |||
25 | foreach ($providers as $name => $credentials) { |
||
26 | $credentials['provider_name'] = $name; |
||
27 | |||
28 | $class = $container->getParameter(sprintf('oauth_rest.provider.%s.class', $name), $name); |
||
29 | $definition = new DefinitionDecorator('oauth_rest.provider.base'); |
||
30 | $definition->setClass($class); |
||
31 | $definition->addMethodCall('setCredentials', [$credentials]); |
||
32 | |||
33 | $container->setDefinition(sprintf('oauth_rest.provider.%s', $name), $definition); |
||
34 | } |
||
35 | } |
||
36 | |||
42 |