| Conditions | 1 |
| Paths | 1 |
| Total Lines | 57 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 52 |
| CRAP Score | 1 |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 18 | 2 | public function getConfigTreeBuilder() |
|
| 19 | { |
||
| 20 | 2 | $treeBuilder = new TreeBuilder(); |
|
| 21 | 2 | $rootNode = $treeBuilder->root('mewes_k_twig_spreadsheet'); |
|
| 22 | |||
| 23 | $rootNode |
||
| 24 | 2 | ->children() |
|
| 25 | 2 | ->booleanNode('pre_calculate_formulas') |
|
| 26 | 2 | ->defaultTrue() |
|
| 27 | 2 | ->info('Disabling formula calculations can improve the performance but the resulting documents won\'t immediately show formula results in external programs.') |
|
| 28 | 2 | ->end() |
|
| 29 | 2 | ->arrayNode('cache') |
|
| 30 | 2 | ->addDefaultsIfNotSet() |
|
| 31 | 2 | ->children() |
|
| 32 | 2 | ->scalarNode('bitmap') |
|
| 33 | 2 | ->defaultValue('%kernel.cache_dir%/spreadsheet/bitmap') |
|
| 34 | 2 | ->cannotBeEmpty() |
|
| 35 | 2 | ->info('Using a bitmap cache is necessary, PhpSpreadsheet supports only local files.') |
|
| 36 | 2 | ->end() |
|
| 37 | 2 | ->scalarNode('xml') |
|
| 38 | 2 | ->defaultFalse() |
|
| 39 | 2 | ->example('"%kernel.cache_dir%/spreadsheet/xml"') |
|
| 40 | 2 | ->info('Using XML caching can improve memory consumption by writing data to disk. Works only for .xlsx and .ods documents.') |
|
| 41 | 2 | ->end() |
|
| 42 | 2 | ->end() |
|
| 43 | 2 | ->end() |
|
| 44 | 2 | ->arrayNode('csv_writer') |
|
| 45 | 2 | ->addDefaultsIfNotSet() |
|
| 46 | 2 | ->info('See PhpOffice\PhpSpreadsheet\Writer\Csv.php for more information.') |
|
| 47 | 2 | ->children() |
|
| 48 | 2 | ->scalarNode('delimiter') |
|
| 49 | 2 | ->defaultValue(',') |
|
| 50 | 2 | ->end() |
|
| 51 | 2 | ->scalarNode('enclosure') |
|
| 52 | 2 | ->defaultValue('"') |
|
| 53 | 2 | ->end() |
|
| 54 | 2 | ->booleanNode('excel_compatibility') |
|
| 55 | 2 | ->defaultFalse() |
|
| 56 | 2 | ->end() |
|
| 57 | 2 | ->booleanNode('include_separator_line') |
|
| 58 | 2 | ->defaultFalse() |
|
| 59 | 2 | ->end() |
|
| 60 | 2 | ->scalarNode('line_ending') |
|
| 61 | 2 | ->defaultValue(PHP_EOL) |
|
| 62 | 2 | ->end() |
|
| 63 | 2 | ->integerNode('sheet_index') |
|
| 64 | 2 | ->defaultValue(0) |
|
| 65 | 2 | ->end() |
|
| 66 | 2 | ->booleanNode('use_bom') |
|
| 67 | 2 | ->defaultFalse() |
|
| 68 | 2 | ->end() |
|
| 69 | 2 | ->end() |
|
| 70 | 2 | ->end() |
|
| 71 | 2 | ->end(); |
|
| 72 | |||
| 73 | 2 | return $treeBuilder; |
|
| 74 | } |
||
| 75 | } |
||
| 76 |