1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Erelke\TwigSpreadsheetBundle\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use RuntimeException; |
6
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
7
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
8
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class Configuration. |
12
|
|
|
*/ |
13
|
|
|
class Configuration implements ConfigurationInterface |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* {@inheritdoc} |
17
|
|
|
* |
18
|
|
|
* @throws RuntimeException |
19
|
|
|
*/ |
20
|
2 |
|
public function getConfigTreeBuilder() |
21
|
|
|
{ |
22
|
2 |
|
if (version_compare(Kernel::VERSION, '4.3.0', '>=')) { |
23
|
2 |
|
$treeBuilder = new TreeBuilder('erelke_twig_spreadsheet'); |
24
|
2 |
|
$rootNode = $treeBuilder->getRootNode(); |
25
|
|
|
} else { |
26
|
|
|
$treeBuilder = new TreeBuilder(); |
27
|
|
|
$rootNode = $treeBuilder->root('erelke_twig_spreadsheet'); |
|
|
|
|
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
$rootNode |
31
|
2 |
|
->children() |
32
|
2 |
|
->booleanNode('pre_calculate_formulas') |
33
|
2 |
|
->defaultTrue() |
34
|
2 |
|
->info('Disabling formula calculations can improve the performance but the resulting documents won\'t immediately show formula results in external programs.') |
35
|
2 |
|
->end() |
36
|
2 |
|
->arrayNode('cache') |
37
|
2 |
|
->addDefaultsIfNotSet() |
38
|
2 |
|
->children() |
39
|
2 |
|
->scalarNode('bitmap') |
40
|
2 |
|
->defaultValue('%kernel.cache_dir%/spreadsheet/bitmap') |
41
|
2 |
|
->cannotBeEmpty() |
42
|
2 |
|
->info('Using a bitmap cache is necessary, PhpSpreadsheet supports only local files.') |
43
|
2 |
|
->end() |
44
|
2 |
|
->scalarNode('xml') |
45
|
2 |
|
->defaultFalse() |
46
|
2 |
|
->example('"%kernel.cache_dir%/spreadsheet/xml"') |
47
|
2 |
|
->info('Using XML caching can improve memory consumption by writing data to disk. Works only for .xlsx and .ods documents.') |
48
|
2 |
|
->end() |
49
|
2 |
|
->end() |
50
|
2 |
|
->end() |
51
|
2 |
|
->arrayNode('csv_writer') |
52
|
2 |
|
->addDefaultsIfNotSet() |
53
|
2 |
|
->info('See PhpOffice\PhpSpreadsheet\Writer\Csv.php for more information.') |
54
|
2 |
|
->children() |
55
|
2 |
|
->scalarNode('delimiter') |
56
|
2 |
|
->defaultValue(',') |
57
|
2 |
|
->end() |
58
|
2 |
|
->scalarNode('enclosure') |
59
|
2 |
|
->defaultValue('"') |
60
|
2 |
|
->end() |
61
|
2 |
|
->booleanNode('excel_compatibility') |
62
|
2 |
|
->defaultFalse() |
63
|
2 |
|
->end() |
64
|
2 |
|
->booleanNode('include_separator_line') |
65
|
2 |
|
->defaultFalse() |
66
|
2 |
|
->end() |
67
|
2 |
|
->scalarNode('line_ending') |
68
|
2 |
|
->defaultValue(PHP_EOL) |
69
|
2 |
|
->end() |
70
|
2 |
|
->integerNode('sheet_index') |
71
|
2 |
|
->defaultValue(0) |
72
|
2 |
|
->end() |
73
|
2 |
|
->booleanNode('use_bom') |
74
|
2 |
|
->defaultFalse() |
75
|
2 |
|
->end() |
76
|
2 |
|
->end() |
77
|
2 |
|
->end() |
78
|
2 |
|
->end(); |
79
|
|
|
|
80
|
2 |
|
return $treeBuilder; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.