AbstractEncryptionSource   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 53
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getNodeDefinition() 0 45 1
A prepend() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2019 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace Jose\Bundle\JoseFramework\DependencyInjection\Source\Encryption;
15
16
use Jose\Bundle\JoseFramework\DependencyInjection\Source\Source;
17
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
20
abstract class AbstractEncryptionSource implements Source
21
{
22
    public function getNodeDefinition(NodeDefinition $node): void
23
    {
24
        $node
25
            ->children()
26
            ->arrayNode($this->name())
27
            ->useAttributeAsKey('name')
28
            ->arrayPrototype()
29
            ->children()
30
            ->booleanNode('is_public')
31
            ->info('If true, the service will be public, else private.')
32
            ->defaultTrue()
33
            ->end()
34
            ->arrayNode('key_encryption_algorithms')
35
            ->info('A list of supported key encryption algorithms.')
36
            ->useAttributeAsKey('name')
37
            ->isRequired()
38
            ->requiresAtLeastOneElement()
39
            ->scalarPrototype()->end()
40
            ->end()
41
            ->arrayNode('content_encryption_algorithms')
42
            ->info('A list of supported content encryption algorithms.')
43
            ->useAttributeAsKey('name')
44
            ->isRequired()
45
            ->requiresAtLeastOneElement()
46
            ->scalarPrototype()->end()
47
            ->end()
48
            ->arrayNode('compression_methods')
49
            ->info('A list of supported compression methods.')
50
            ->useAttributeAsKey('name')
51
            ->defaultValue(['DEF'])
52
            ->scalarPrototype()->end()
53
            ->end()
54
            ->arrayNode('tags')
55
            ->info('A list of tags to be associated to the service.')
56
            ->useAttributeAsKey('name')
57
            ->treatNullLike([])
58
            ->treatFalseLike([])
59
            ->variablePrototype()->end()
60
            ->end()
61
            ->end()
62
            ->end()
63
            ->end()
64
            ->end()
65
        ;
66
    }
67
68
    public function prepend(ContainerBuilder $container, array $config): array
69
    {
70
        return [];
71
    }
72
}
73