Failed Conditions
Push — ng ( 962349...975869 )
by Florent
03:54
created

CustomValuesSource::name()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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 OAuth2Framework\Bundle\DependencyInjection\Component\Endpoint\Metadata;
15
16
use OAuth2Framework\Bundle\DependencyInjection\Component\Component;
17
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
20
class CustomValuesSource implements Component
21
{
22
    /**
23
     * @return string
24
     */
25
    public function name(): string
26
    {
27
        return 'custom_routes';
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function load(array $configs, ContainerBuilder $container)
34
    {
35
        $container->setParameter('oauth2_server.endpoint.metadata.custom_values', $configs['endpoint']['metadata']['custom_values']);
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function getNodeDefinition(NodeDefinition $node)
42
    {
43
        $node->children()
44
            ->arrayNode('custom_values')
45
                ->info('Custom values added to the metadata response.')
46
                ->useAttributeAsKey('name')
47
                ->prototype('variable')->end()
48
                ->treatNullLike([])
49
                ->treatFalseLike([])
50
            ->end()
51
        ->end();
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    public function prepend(ContainerBuilder $container, array $config): array
58
    {
59
        return [];
60
    }
61
}
62