| Conditions | 1 |
| Paths | 1 |
| Total Lines | 26 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function getConfigTreeBuilder() |
||
| 19 | { |
||
| 20 | $treeBuilder = new TreeBuilder(); |
||
| 21 | $rootNode = $treeBuilder->root('dekalee_adback_analytics'); |
||
| 22 | |||
| 23 | $supportedCacheTypes = ['redis', 'doctrine', 'config_file']; |
||
| 24 | |||
| 25 | $rootNode->children() |
||
| 26 | ->scalarNode('access_token')->isRequired()->end() |
||
| 27 | ->scalarNode('api_url')->defaultValue('https://adback.co/api')->end() |
||
| 28 | ->scalarNode('script_url')->defaultValue('script/me')->end() |
||
| 29 | ->scalarNode('cache_type') |
||
| 30 | ->validate() |
||
| 31 | ->ifNotInArray($supportedCacheTypes) |
||
| 32 | ->thenInvalid('The driver %s is not supported. Please choose one of '.json_encode($supportedCacheTypes)) |
||
| 33 | ->end() |
||
| 34 | ->cannotBeOverwritten() |
||
| 35 | ->cannotBeEmpty() |
||
| 36 | ->defaultValue('redis') |
||
| 37 | ->end() |
||
| 38 | ->scalarNode('cache_service')->defaultValue('redis')->end() |
||
| 39 | ->scalarNode('entity_manager')->defaultValue('doctrine.orm.entity_manager')->end() |
||
| 40 | ->end(); |
||
| 41 | |||
| 42 | return $treeBuilder; |
||
| 43 | } |
||
| 44 | } |
||
| 45 |