Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 84.62%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 22
ccs 11
cts 13
cp 0.8462
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 20 2
1
<?php declare(strict_types=1);
2
3
namespace Karser\Recaptcha3Bundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
class Configuration implements ConfigurationInterface
9
{
10 7
    public function getConfigTreeBuilder()
11
    {
12 7
        if (method_exists(TreeBuilder::class, 'getRootNode')) {
13 7
            $treeBuilder = new TreeBuilder('karser_recaptcha3');
14 7
            $rootNode = $treeBuilder->getRootNode();
15
        } else {
16
            // BC layer for symfony/config 4.1 and older
17
            $treeBuilder = new TreeBuilder();
18
            $rootNode = $treeBuilder->root('karser_recaptcha3', 'array');
0 ignored issues
show
Deprecated Code introduced by
The function Symfony\Component\Config...der\TreeBuilder::root() has been deprecated: since Symfony 4.3, pass the root name to the constructor instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

18
            $rootNode = /** @scrutinizer ignore-deprecated */ $treeBuilder->root('karser_recaptcha3', 'array');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
19
        }
20
        $rootNode
21 7
            ->children()
22 7
                ->scalarNode('site_key')->isRequired()->end()
23 7
                ->scalarNode('secret_key')->isRequired()->end()
24 7
                ->floatNode('score_threshold')->min(0.0)->max(1.0)->defaultValue(0.5)->end()
25 7
                ->booleanNode('enabled')->defaultTrue()->end()
26 7
            ->end()
27
        ;
28
29 7
        return $treeBuilder;
30
    }
31
}
32