-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfiguration.php
57 lines (52 loc) · 2 KB
/
Configuration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace Funstaff\RefLibRisBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* Configuration
*
* @author Bertrand Zuchuat <[email protected]>
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('ref_lib_ris');
$rootNode
->children()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('ris_mappings')->defaultValue('Funstaff\RefLibRis\RisMappings')->end()
->scalarNode('record_processing')->defaultValue('Funstaff\RefLibRis\RecordProcessing')->end()
->scalarNode('ris_definition')->defaultValue('Funstaff\RefLibRis\RisDefinition')->end()
->scalarNode('ris_writer')->defaultValue('Funstaff\RefLibRis\RisWriter')->end()
->end()
->end()
->scalarNode('fallback')->isRequired()->end()
->arrayNode('mappings')
->isRequired()
->requiresAtLeastOneElement()
->useAttributeAsKey('name')
->prototype('array')
->requiresAtLeastOneElement()
->prototype('array')
->useAttributeAsKey('name')
->prototype('scalar')->end()
->end()
->validate()
->ifTrue(function($v) {
return !array_key_exists('TY', $v);
})
->thenInvalid('TY field is mandatory')
->end()
->end()
->end()
;
return $treeBuilder;
}
}