Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 24
dl 0
loc 31
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 18 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hgraca\DoctrineTestDbRegenerationBundle\DependencyInjection;
6
7
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
8
use Symfony\Component\Config\Definition\ConfigurationInterface;
9
10
class Configuration implements ConfigurationInterface
11
{
12
    public const ROOT = 'hgraca_doctrine_test_db_regeneration';
13
    public const FIXTURES_LOADER_SERVICE_ID = 'fixtures_loader_service_id';
14
    public const TEST_DB_BKP_PATH = 'test_db_bkp_path';
15
    public const DB_CONFIG_LIST = 'db_config_list';
16
    public const DOCTRINE_SERVICE_ID = 'doctrine_service_id';
17
    public const EXTRA_SERVICE_LIST = 'extra_service_list';
18
19
    public const DEFAULT_DOCTRINE_SERVICE_ID = 'doctrine';
20
    public const DEFAULT_FIXTURES_LOADER_SERVICE_ID = 'doctrine.fixtures.loader';
21
    public const DEFAULT_TEST_DB_BKP_PATH = '%kernel.cache_dir%/test.bkp.db';
22
23 10
    public function getConfigTreeBuilder(): TreeBuilder
24
    {
25 10
        $treeBuilder = new TreeBuilder();
26 10
        $root = $treeBuilder->root(self::ROOT);
27
28
        $root
29 10
            ->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

29
            ->/** @scrutinizer ignore-call */ 
30
              addDefaultsIfNotSet()
Loading history...
30 10
            ->children()
31 10
                ->scalarNode(self::DOCTRINE_SERVICE_ID)->defaultValue(self::DEFAULT_DOCTRINE_SERVICE_ID)->end()
32 10
                ->scalarNode(self::FIXTURES_LOADER_SERVICE_ID)->defaultValue(self::DEFAULT_FIXTURES_LOADER_SERVICE_ID)->end()
33 10
                ->scalarNode(self::TEST_DB_BKP_PATH)->defaultValue(self::DEFAULT_TEST_DB_BKP_PATH)->end()
34 10
                ->arrayNode(self::EXTRA_SERVICE_LIST)
35 10
                    ->info('The list of extra services to add to the container, in case you want to reuse this already built container.')
36 10
                    ->scalarPrototype()->end()
37 10
                ->end()
38 10
            ->end();
39
40 10
        return $treeBuilder;
41
    }
42
}
43