Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 18
ccs 12
cts 12
cp 1
rs 9.8666
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace Yoanm\SymfonyJsonRpcHttpServerDoc\DependencyInjection;
3
4
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
5
use Symfony\Component\Config\Definition\ConfigurationInterface;
6
7
/**
8
 * Class Configuration
9
 */
10
class Configuration implements ConfigurationInterface
11
{
12
    const DEFAULT_ENDPOINT = '/doc';
13
    /**
14
     * {@inheritdoc}
15
     */
16 1
    public function getConfigTreeBuilder()
17
    {
18 1
        $treeBuilder = new TreeBuilder();
19
20 1
        $rootNode = $treeBuilder->root(JsonRpcHttpServerDocExtension::EXTENSION_IDENTIFIER);
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

20
        $rootNode = /** @scrutinizer ignore-deprecated */ $treeBuilder->root(JsonRpcHttpServerDocExtension::EXTENSION_IDENTIFIER);

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...
21
22
        $rootNode
23 1
            ->addDefaultsIfNotSet()
0 ignored issues
show
Bug introduced by
The method addDefaultsIfNotSet() does not exist on Symfony\Component\Config...\Builder\NodeDefinition. It seems like you code against a sub-type of Symfony\Component\Config...\Builder\NodeDefinition such as Symfony\Component\Config...der\ArrayNodeDefinition. ( Ignorable by Annotation )

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

23
            ->/** @scrutinizer ignore-call */ 
24
              addDefaultsIfNotSet()
Loading history...
24 1
            ->children()
25 1
                ->variableNode('endpoint')
26 1
                    ->info('Your custom http doc endpoint path')
27 1
                    ->treatNullLike(self::DEFAULT_ENDPOINT)
28 1
                    ->defaultValue(self::DEFAULT_ENDPOINT)
29 1
                ->end()
30 1
            ->end()
31
        ;
32
33 1
        return $treeBuilder;
34
    }
35
}
36