GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( 58ccc5...f31612 )
by Elemér
05:08
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 62

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 53
CRAP Score 2.0001

Importance

Changes 0
Metric Value
dl 0
loc 62
ccs 53
cts 55
cp 0.9636
rs 8.829
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2.0001

How to fix   Long Method   

Long Method

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:

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');
0 ignored issues
show
Deprecated Code introduced by
The method Symfony\Component\Config...der\TreeBuilder::root() has been deprecated with message: since Symfony 4.3, pass the root name to the constructor instead

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.

Loading history...
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