Conditions | 5 |
Paths | 4 |
Total Lines | 28 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 17 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
15 | 4 | public function load(array $configs, ContainerBuilder $container) |
|
16 | { |
||
17 | 4 | $configuration = new Configuration(); |
|
18 | 4 | $config = $this->processConfiguration($configuration, $configs); |
|
19 | |||
20 | 4 | $container->setParameter('ddr.rest.paths', $config['paths']); |
|
21 | |||
22 | 4 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
23 | 4 | $loader->load('services.yml'); |
|
24 | |||
25 | 4 | $directories = []; |
|
26 | 4 | if (array_key_exists('metadata', $config) && array_key_exists('directories', $config['metadata'])) { |
|
27 | 2 | foreach ($config['metadata']['directories'] as $directory) { |
|
28 | 2 | $directories[$directory['namespace_prefix']] = $directory['path']; |
|
29 | } |
||
30 | } |
||
31 | |||
32 | $container |
||
33 | 4 | ->getDefinition('ddr_rest.metadata.file_locator') |
|
34 | 4 | ->setArguments([$directories]); |
|
35 | |||
36 | 4 | if (null !== $config['access_token_class']) { |
|
37 | 2 | $container->setParameter('ddr.rest.access_token_class', $config['access_token_class']); |
|
38 | 2 | $container->setParameter('ddr.rest.authentication_provider_key', $config['authentication_provider_key']); |
|
39 | |||
40 | 2 | $loader->load('services_security.yml'); |
|
41 | } |
||
42 | 4 | } |
|
43 | } |
||
44 |