Passed
Pull Request — master (#7)
by Pol
22:18 queued 20:04
created

Configuration::getDefaultEnvs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 25
ccs 2
cts 2
cp 1
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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
8
declare(strict_types=1);
9
10
namespace EcPhp\ApiGwAuthenticationBundle\DependencyInjection;
11
12
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
13
use Symfony\Component\Config\Definition\ConfigurationInterface;
14
15
class Configuration implements ConfigurationInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 1
    public function getConfigTreeBuilder(): TreeBuilder
21
    {
22 1
        $treeBuilder = new TreeBuilder('api_gw_authentication');
23
24
        /** @var \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $rootNode */
25 1
        $rootNode = $treeBuilder->getRootNode();
26
27
        /** @phpstan-ignore-next-line */
28
        $rootNode
29 1
            ->children()
30 1
            ->arrayNode('defaults')
31 1
            ->children()
32 1
            ->enumNode('env')
33 1
            ->values(['production', 'acceptance', 'intra', 'user'])
34 1
            ->defaultValue('production')
35 1
            ->isRequired()
36 1
            ->cannotBeEmpty()
37 1
            ->end()
38 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

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