Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 52
dl 0
loc 68
ccs 32
cts 32
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 39 1
A getDefaultEnvs() 0 25 1
1
<?php
2
3
/**
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 *
7
 * @see https://github.com/ecphp
8
 */
9
10
declare(strict_types=1);
11
12
namespace EcPhp\ApiGwAuthenticationBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
class Configuration implements ConfigurationInterface
18
{
19 1
    public function getConfigTreeBuilder(): TreeBuilder
20
    {
21 1
        $treeBuilder = new TreeBuilder('api_gw_authentication');
22
23
        /** @var \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $rootNode */
24 1
        $rootNode = $treeBuilder->getRootNode();
25
26
        /** @phpstan-ignore-next-line */
27
        $rootNode
28 1
            ->children()
29 1
            ->arrayNode('defaults')
30 1
            ->children()
31 1
            ->enumNode('env')
32 1
            ->values(['production', 'acceptance', 'intra', 'user'])
33 1
            ->defaultValue('production')
34 1
            ->isRequired()
35 1
            ->cannotBeEmpty()
36 1
            ->end()
37 1
            ->end()
0 ignored issues
show
Bug introduced by
The method end() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Symfony\Component\Config...ion\Builder\TreeBuilder. Are you sure you never get one of those? ( Ignorable by Annotation )

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

37
            ->/** @scrutinizer ignore-call */ end()
Loading history...
38 1
            ->end()
39 1
            ->arrayNode('envs')
40 1
            ->defaultValue($this->getDefaultEnvs())
41 1
            ->useAttributeAsKey('name')
42 1
            ->arrayPrototype()
43 1
            ->children()
44 1
            ->scalarNode('public')->end()
45 1
            ->scalarNode('private')->defaultValue('')->end()
46 1
            ->arrayNode('failsafe')
47 1
            ->children()
48 1
            ->scalarNode('public')->defaultValue('')->end()
49 1
            ->scalarNode('private')->defaultValue('')->end()
50 1
            ->end()
51 1
            ->end()
52 1
            ->end()
53 1
            ->end()
54 1
            ->end()
55 1
            ->end();
56
57 1
        return $treeBuilder;
58
    }
59
60
    private function getDefaultEnvs(): array
61
    {
62
        return [
63
            'acceptance' => [
64
                'public' => 'https://api.acceptance.tech.ec.europa.eu/federation/oauth/token/.well-known/jwks.json',
65
                'private' => null,
66
                'failsafe' => [
67
                    'public' => '',
68
                    'private' => '',
69
                ],
70
            ],
71
            'production' => [
72
                'public' => 'https://api.tech.ec.europa.eu/federation/oauth/token/.well-known/jwks.json',
73
                'private' => null,
74
                'failsafe' => [
75
                    'public' => '',
76
                    'private' => '',
77
                ],
78
            ],
79
            'intra' => [
80
                'public' => 'https://intrapi.tech.ec.europa.eu/federation/oauth/token/.well-known/jwks.json',
81
                'private' => null,
82
                'failsafe' => [
83
                    'public' => '',
84
                    'private' => '',
85
                ],
86
            ],
87
        ];
88
    }
89
}
90