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