Conditions | 2 |
Paths | 2 |
Total Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Tests | 20 |
CRAP Score | 2.0004 |
Changes | 0 |
1 | <?php |
||
16 | 1 | public function getConfigTreeBuilder() |
|
17 | { |
||
18 | 1 | $treeBuilder = new TreeBuilder(); |
|
|
|||
19 | 1 | $treeBuilder = new TreeBuilder('happyr_google_analytics'); |
|
20 | // Keep compatibility with symfony/config < 4.2 |
||
21 | 1 | if (!method_exists($treeBuilder, 'getRootNode')) { |
|
22 | $root = $treeBuilder->root('happyr_google_analytics'); |
||
23 | } else { |
||
24 | 1 | $root = $treeBuilder->getRootNode(); |
|
25 | } |
||
26 | |||
27 | $root |
||
28 | 1 | ->children() |
|
29 | 1 | ->booleanNode('enabled')->defaultTrue()->info('If disabled we will not send any data')->end() |
|
30 | 1 | ->scalarNode('version')->cannotBeEmpty()->defaultValue(1)->info('The version of the Measurement Protocol')->end() |
|
31 | 1 | ->scalarNode('tracking_id')->isRequired()->cannotBeEmpty()->end() |
|
32 | |||
33 | 1 | ->scalarNode('endpoint')->defaultValue('http://www.google-analytics.com/collect')->cannotBeEmpty()->end() |
|
34 | 1 | ->scalarNode('http_client')->defaultValue('httplug.client')->end() |
|
35 | 1 | ->scalarNode('http_message_factory')->defaultValue('httplug.message_factory')->end() |
|
36 | |||
37 | 1 | ->arrayNode('fetching')->addDefaultsIfNotSet()->children() |
|
38 | 1 | ->integerNode('view_id')->defaultNull()->info('The google analytics view id. This is not the same as the tracking code.')->end() |
|
39 | 1 | ->scalarNode('cache_service')->defaultNull()->end() |
|
40 | 1 | ->integerNode('cache_lifetime')->defaultValue(3600)->end() |
|
41 | 1 | ->scalarNode('client_service')->defaultNull()->end() |
|
42 | 1 | ->end() |
|
43 | 1 | ->end()->end(); |
|
44 | |||
45 | 1 | return $treeBuilder; |
|
46 | } |
||
47 | } |
||
48 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.