Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 21 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\TinyPngBundle\DependencyInjection;
6
7
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
8
use Symfony\Component\Config\Definition\ConfigurationInterface;
9
10
final class Configuration implements ConfigurationInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function getConfigTreeBuilder(): TreeBuilder
16
    {
17
        $treeBuilder = new TreeBuilder();
18
        $rootNode = $treeBuilder->root('setono_tiny_png');
19
        $rootNode
20
            ->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

20
            ->/** @scrutinizer ignore-call */ 
21
              addDefaultsIfNotSet()
Loading history...
21
            ->children()
22
                ->scalarNode('api_key')
23
                    ->isRequired()
24
                    ->cannotBeEmpty()
25
                    ->info('Your TinyPNG API key')
26
                ->end()
27
                ->scalarNode('proxy')
28
                    ->defaultNull()
29
                    ->cannotBeEmpty()
30
                    ->info('The proxy to use')
31
                ->end()
32
            ->end()
33
        ;
34
35
        return $treeBuilder;
36
    }
37
}
38