Conditions | 2 |
Paths | 1 |
Total Lines | 24 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
18 | public function getConfigTreeBuilder() |
||
19 | { |
||
20 | $treeBuilder = new TreeBuilder(); |
||
21 | $root = $treeBuilder->root('happyr_serializer'); |
||
22 | |||
23 | $root->children() |
||
24 | ->booleanNode('twig_extension')->defaultFalse()->end() |
||
25 | ->arrayNode('source') |
||
26 | ->prototype('scalar') |
||
27 | ->validate() |
||
28 | ->always(function ($v) { |
||
29 | $v = str_replace(DIRECTORY_SEPARATOR, '/', $v); |
||
30 | |||
31 | if (!is_dir($v)) { |
||
32 | throw new \Exception(sprintf('The directory "%s" does not exist.', $v)); |
||
33 | } |
||
34 | |||
35 | return $v; |
||
36 | }) |
||
37 | ->end() |
||
38 | ->end(); |
||
39 | |||
40 | return $treeBuilder; |
||
41 | } |
||
42 | } |
||
43 |