Failed Conditions
Pull Request — master (#74)
by Florent
03:06 queued 57s
created

AbstractSignatureSource::getNodeDefinition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.2
c 0
b 0
f 0
cc 1
eloc 20
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 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\Signature;
15
16
use Jose\Bundle\JoseFramework\DependencyInjection\Source\Source;
17
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
20
/**
21
 * Class AbstractSource.
22
 */
23
abstract class AbstractSignatureSource implements Source
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getNodeDefinition(ArrayNodeDefinition $node)
29
    {
30
        $node
31
            ->children()
32
                ->arrayNode($this->name())
33
                    ->useAttributeAsKey('name')
34
                    ->prototype('array')
35
                        ->children()
36
                            ->booleanNode('is_public')
37
                                ->info('If true, the service will be public, else private.')
38
                                ->defaultTrue()
39
                            ->end()
40
                            ->arrayNode('signature_algorithms')
41
                                ->useAttributeAsKey('name')
42
                                ->isRequired()
43
                                ->prototype('scalar')->end()
44
                            ->end()
45
                        ->end()
46
                    ->end()
47
                ->end()
48
            ->end();
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function prepend(ContainerBuilder $container, array $config): array
55
    {
56
        return [];
57
    }
58
}
59