Conditions | 2 |
Paths | 2 |
Total Lines | 29 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 24 |
CRAP Score | 2 |
Changes | 6 | ||
Bugs | 1 | Features | 4 |
1 | <?php |
||
17 | 24 | public function load(array $configs, ContainerBuilder $container) |
|
18 | { |
||
19 | 24 | $configuration = new Configuration; |
|
20 | 24 | $config = $this->processConfiguration($configuration, $configs); |
|
21 | 24 | $loader = new Loader\YamlFileLoader( |
|
22 | 24 | $container, |
|
23 | 24 | new FileLocator(__DIR__ . '/../Resources/config') |
|
24 | 24 | ); |
|
25 | 24 | $loader->load('services.yml'); |
|
26 | |||
27 | 24 | $registry = $container->getDefinition('innmind_rest.server.registry'); |
|
28 | 24 | $registry->addMethodCall( |
|
29 | 24 | 'load', |
|
30 | 24 | [['collections' => $config['server']['collections']]] |
|
31 | 24 | ); |
|
32 | |||
33 | 24 | if ($config['server']['prefix'] !== null) { |
|
34 | 2 | $definition = new Definition( |
|
35 | 2 | RoutingListener::class, |
|
36 | 2 | [$config['server']['prefix']] |
|
37 | 2 | ); |
|
38 | 2 | $definition->addTag('kernel.event_subscriber'); |
|
39 | |||
40 | 2 | $container->setDefinition( |
|
41 | 2 | 'innmind_rest.server.listener.route', |
|
42 | $definition |
||
43 | 2 | ); |
|
44 | 2 | } |
|
45 | 24 | } |
|
46 | } |
||
47 |