| Conditions | 1 |
| Paths | 1 |
| Total Lines | 57 |
| Lines | 0 |
| Ratio | 0 % |
| 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 |
||
| 19 | public function getConfigTreeBuilder() |
||
| 20 | { |
||
| 21 | $treeBuilder = new TreeBuilder('erelke_twig_spreadsheet'); |
||
| 22 | $rootNode = $treeBuilder->getRootNode(); |
||
| 23 | |||
| 24 | $rootNode |
||
| 25 | ->children() |
||
| 26 | ->booleanNode('pre_calculate_formulas') |
||
| 27 | ->defaultTrue() |
||
| 28 | ->info('Disabling formula calculations can improve the performance but the resulting documents won\'t immediately show formula results in external programs.') |
||
| 29 | ->end() |
||
| 30 | ->arrayNode('cache') |
||
| 31 | ->addDefaultsIfNotSet() |
||
| 32 | ->children() |
||
| 33 | ->scalarNode('bitmap') |
||
| 34 | ->defaultValue('%kernel.cache_dir%/spreadsheet/bitmap') |
||
| 35 | ->cannotBeEmpty() |
||
| 36 | ->info('Using a bitmap cache is necessary, PhpSpreadsheet supports only local files.') |
||
| 37 | ->end() |
||
| 38 | ->scalarNode('xml') |
||
| 39 | ->defaultFalse() |
||
| 40 | ->example('"%kernel.cache_dir%/spreadsheet/xml"') |
||
| 41 | ->info('Using XML caching can improve memory consumption by writing data to disk. Works only for .xlsx and .ods documents.') |
||
| 42 | ->end() |
||
| 43 | ->end() |
||
| 44 | ->end() |
||
| 45 | ->arrayNode('csv_writer') |
||
| 46 | ->addDefaultsIfNotSet() |
||
| 47 | ->info('See PhpOffice\PhpSpreadsheet\Writer\Csv.php for more information.') |
||
| 48 | ->children() |
||
| 49 | ->scalarNode('delimiter') |
||
| 50 | ->defaultValue(',') |
||
| 51 | ->end() |
||
| 52 | ->scalarNode('enclosure') |
||
| 53 | ->defaultValue('"') |
||
| 54 | ->end() |
||
| 55 | ->booleanNode('excel_compatibility') |
||
| 56 | ->defaultFalse() |
||
| 57 | ->end() |
||
| 58 | ->booleanNode('include_separator_line') |
||
| 59 | ->defaultFalse() |
||
| 60 | ->end() |
||
| 61 | ->scalarNode('line_ending') |
||
| 62 | ->defaultValue(PHP_EOL) |
||
| 63 | ->end() |
||
| 64 | ->integerNode('sheet_index') |
||
| 65 | ->defaultValue(0) |
||
| 66 | ->end() |
||
| 67 | ->booleanNode('use_bom') |
||
| 68 | ->defaultFalse() |
||
| 69 | ->end() |
||
| 70 | ->end() |
||
| 71 | ->end() |
||
| 72 | ->end(); |
||
| 73 | |||
| 74 | return $treeBuilder; |
||
| 75 | } |
||
| 76 | } |
||
| 77 |