| Conditions | 1 |
| Paths | 1 |
| Total Lines | 25 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 20 | public function getConfigTreeBuilder() |
||
| 21 | { |
||
| 22 | $treeBuilder = new TreeBuilder(); |
||
| 23 | $root = $treeBuilder->root('koff_i18n_form')->children(); |
||
| 24 | |||
| 25 | $convertStringToArray = function ($v) { |
||
| 26 | return preg_split('/\s*[,|]\s*/', $v); |
||
| 27 | }; |
||
| 28 | |||
| 29 | $locales = $root->arrayNode('locales'); |
||
| 30 | $locales->defaultValue(['en']); |
||
| 31 | $locales->beforeNormalization()->ifString()->then($convertStringToArray); |
||
| 32 | $locales->requiresAtLeastOneElement(); |
||
| 33 | $locales->prototype('scalar'); |
||
| 34 | |||
| 35 | $required = $root->arrayNode('required_locales'); |
||
| 36 | $required->beforeNormalization()->ifString()->then($convertStringToArray); |
||
| 37 | $required->prototype('scalar'); |
||
| 38 | |||
| 39 | $excluded = $root->arrayNode('excluded_fields'); |
||
| 40 | $excluded->defaultValue(['id', 'locale', 'translatable']); |
||
| 41 | $excluded->beforeNormalization()->ifString()->then($convertStringToArray); |
||
| 42 | $excluded->prototype('scalar'); |
||
| 43 | |||
| 44 | return $treeBuilder; |
||
| 45 | } |
||
| 47 |