Conditions | 4 |
Paths | 6 |
Total Lines | 23 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
18 | public function load(array $configs, ContainerBuilder $container) |
||
19 | { |
||
20 | $configuration = new Configuration(); |
||
21 | $config = $this->processConfiguration($configuration, $configs); |
||
22 | |||
23 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
||
24 | $loader->load('services.yml'); |
||
25 | |||
26 | if ($config['twig_extension']) { |
||
27 | $loader->load('twig.yml'); |
||
28 | } |
||
29 | |||
30 | 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 | $container->getDefinition('happyr.serializer.metadata.annotation_reader') |
||
39 | ->replaceArgument(0, $config['source']); |
||
40 | } |
||
41 | } |
||
42 |