| Conditions | 1 |
| Paths | 1 |
| Total Lines | 34 |
| Code Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 28 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 5 | public function getConfigTreeBuilder() |
|
| 19 | { |
||
| 20 | 5 | $treeBuilder = new TreeBuilder(); |
|
| 21 | 5 | $rootNode = $treeBuilder->root('ref_lib_ris'); |
|
| 22 | |||
| 23 | $rootNode |
||
| 24 | 5 | ->children() |
|
| 25 | 5 | ->arrayNode('classes') |
|
| 26 | 5 | ->addDefaultsIfNotSet() |
|
| 27 | 5 | ->children() |
|
| 28 | 5 | ->scalarNode('ris_fields_mapping')->defaultValue('Funstaff\RefLibRis\RisFieldsMapping')->end() |
|
| 29 | 5 | ->scalarNode('record_processing')->defaultValue('Funstaff\RefLibRis\RecordProcessing')->end() |
|
| 30 | 5 | ->scalarNode('ris_definition')->defaultValue('Funstaff\RefLibRis\RisDefinition')->end() |
|
| 31 | 5 | ->scalarNode('ris_writer')->defaultValue('Funstaff\RefLibRis\RisWriter')->end() |
|
| 32 | 5 | ->end() |
|
| 33 | 5 | ->end() |
|
| 34 | 5 | ->arrayNode('mapping_fields') |
|
| 35 | 5 | ->isRequired() |
|
| 36 | 5 | ->requiresAtLeastOneElement() |
|
| 37 | 5 | ->useAttributeAsKey('name') |
|
| 38 | 5 | ->prototype('array') |
|
| 39 | 5 | ->prototype('scalar')->end() |
|
| 40 | 5 | ->end() |
|
| 41 | 5 | ->validate() |
|
| 42 | 5 | ->ifTrue(function($v) { |
|
| 43 | 4 | return !array_key_exists('TY', $v); |
|
| 44 | 5 | }) |
|
| 45 | 5 | ->thenInvalid('TY field is mandatory') |
|
| 46 | 5 | ->end() |
|
| 47 | 5 | ->end() |
|
| 48 | ; |
||
| 49 | |||
| 50 | 5 | return $treeBuilder; |
|
| 51 | } |
||
| 52 | } |
||
| 53 |