| Conditions | 1 |
| Paths | 1 |
| Total Lines | 38 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 1 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 28 | 2 | public function getConfigTreeBuilder() |
|
| 29 | { |
||
| 30 | $treeBuilder = new TreeBuilder(); |
||
| 31 | 2 | $rootNode = $treeBuilder->root('ivoaz_content_editable'); |
|
| 32 | 2 | ||
| 33 | 2 | $supportedModelTypes = [self::MODEL_ORM, self::MODEL_MONGODB]; |
|
| 34 | |||
| 35 | 2 | $rootNode |
|
| 36 | ->addDefaultsIfNotSet() |
||
| 37 | ->children() |
||
| 38 | |||
| 39 | ->scalarNode('model_type') |
||
| 40 | ->validate() |
||
| 41 | ->ifNotInArray($supportedModelTypes) |
||
| 42 | ->thenInvalid( |
||
| 43 | sprintf( |
||
| 44 | 'The model type "%%s" is not supported. Please use one of the following model type: %s.', |
||
| 45 | implode(', ', $supportedModelTypes) |
||
| 46 | ) |
||
| 47 | ) |
||
| 48 | ->end() |
||
| 49 | ->cannotBeEmpty() |
||
| 50 | ->defaultValue(self::MODEL_ORM) |
||
| 51 | ->end() |
||
| 52 | |||
| 53 | ->scalarNode('model_manager_name') |
||
| 54 | ->defaultValue(null) |
||
| 55 | ->end() |
||
| 56 | |||
| 57 | ->scalarNode('editor') |
||
| 58 | ->cannotBeEmpty() |
||
| 59 | ->defaultValue('ivoaz_content_editable.default_editor') |
||
| 60 | ->end() |
||
| 61 | |||
| 62 | ->end(); |
||
| 63 | |||
| 64 | return $treeBuilder; |
||
| 65 | } |
||
| 66 | } |
||
| 67 |