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