| Conditions | 3 |
| Paths | 1 |
| Total Lines | 45 |
| Code Lines | 32 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 30 |
| CRAP Score | 3.0261 |
| Changes | 6 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 1 | public function getConfigTreeBuilder(): TreeBuilder |
|
| 18 | { |
||
| 19 | 1 | $treeBuilder = new TreeBuilder(self::CONFIG_NAME); |
|
| 20 | 1 | $nodeDefinition = $treeBuilder->getRootNode(); |
|
| 21 | 1 | ||
| 22 | 1 | $nodeDefinition |
|
| 23 | ->children() |
||
| 24 | ->arrayNode('dictionaries') |
||
| 25 | ->useAttributeAsKey('name') |
||
| 26 | 1 | ->prototype('array') |
|
| 27 | 1 | ->beforeNormalization() |
|
| 28 | 1 | ->always() |
|
| 29 | 1 | ->then(static function ($values) { |
|
| 30 | 1 | if (false === \array_key_exists('type', $values)) { |
|
| 31 | 1 | if (false === \array_key_exists('content', $values)) { |
|
| 32 | 1 | return ['type' => 'value', 'content' => $values]; |
|
| 33 | } |
||
| 34 | |||
| 35 | return array_merge($values, ['type' => 'value']); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var non-empty-array<mixed> $values |
||
| 40 | */ |
||
| 41 | return $values; |
||
| 42 | 1 | }) |
|
| 43 | 1 | ->end() |
|
| 44 | 1 | ->children() |
|
| 45 | 1 | ->scalarNode('type')->defaultValue('value')->end() |
|
| 46 | 1 | ->scalarNode('extends')->end() |
|
| 47 | 1 | ->arrayNode('dictionaries') |
|
| 48 | 1 | ->normalizeKeys(false)->prototype('scalar')->end() |
|
| 49 | 1 | ->end() |
|
| 50 | 1 | ->arrayNode('content') |
|
| 51 | 1 | ->normalizeKeys(false)->prototype('scalar')->end() |
|
| 52 | 1 | ->end() |
|
| 53 | 1 | ->scalarNode('service')->end() |
|
| 54 | 1 | ->scalarNode('method')->end() |
|
| 55 | 1 | ->end() |
|
| 56 | 1 | ->end() |
|
| 57 | 1 | ->end() |
|
| 58 | 1 | ->end() |
|
| 59 | ; |
||
| 60 | |||
| 61 | 1 | return $treeBuilder; |
|
| 62 | } |
||
| 64 |