Conditions | 4 |
Paths | 6 |
Total Lines | 23 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5.1173 |
Changes | 4 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
18 | 23 | public function load(array $configs, ContainerBuilder $container) |
|
19 | { |
||
20 | 23 | $configuration = new Configuration(); |
|
21 | 23 | $config = $this->processConfiguration($configuration, $configs); |
|
22 | |||
23 | 23 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
24 | 23 | $loader->load('services.yml'); |
|
25 | |||
26 | 23 | if ($config['twig_extension']) { |
|
27 | $loader->load('twig.yml'); |
||
28 | } |
||
29 | |||
30 | 23 | if (empty($config['source'])) { |
|
31 | // Try to help |
||
32 | $path = $container->getParameter('kernel.root_dir').'/../src'; |
||
33 | if (!is_dir($path)) { |
||
34 | throw new \Exception('You must specify a path at happyr_serializer.source'); |
||
35 | } |
||
36 | $config['source'] = [$path]; |
||
37 | } |
||
38 | 23 | $container->getDefinition('happyr.serializer.metadata.annotation_reader') |
|
39 | 23 | ->replaceArgument(0, $config['source']); |
|
40 | 23 | } |
|
41 | } |
||
42 |