| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 7 | public function getConfigTreeBuilder() |
|
| 16 | { |
||
| 17 | 7 | $treeBuilder = new TreeBuilder(); |
|
| 18 | 7 | $rootNode = $treeBuilder->root('flagbit_currency'); |
|
| 19 | |||
| 20 | $rootNode |
||
| 21 | 7 | ->children() |
|
| 22 | 7 | ->scalarNode('default_currency') |
|
| 23 | 7 | ->info('ISO 4217 currency code') |
|
| 24 | 7 | ->validate() |
|
| 25 | 7 | ->ifTrue(function ($v) { |
|
| 26 | 5 | return 1 !== preg_match('/^[A-Z]{3}$/', $v); |
|
| 27 | 7 | }) |
|
| 28 | 7 | ->thenInvalid('Invalid currency code "%s"') |
|
| 29 | 7 | ->end() |
|
| 30 | 7 | ->defaultValue('EUR') |
|
| 31 | 7 | ->end() |
|
| 32 | 7 | ->end(); |
|
| 33 | |||
| 34 | 7 | return $treeBuilder; |
|
| 35 | } |
||
| 36 | } |
||
| 37 |