PublicJWKSet   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 40
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createDefinition() 0 11 1
A getKeySet() 0 4 1
A addConfiguration() 0 11 1
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2016 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace SpomkyLabs\JoseBundle\DependencyInjection\Source\JWKSetSource;
13
14
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Definition;
17
use Symfony\Component\DependencyInjection\Reference;
18
19
final class PublicJWKSet extends AbstractJWKSetSource
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function createDefinition(ContainerBuilder $container, array $config)
25
    {
26
        $definition = new Definition('Jose\Object\JWKSet');
27
        $definition->setFactory([
28
            new Reference('jose.factory.jwk'),
29
            'createPublicKeySet',
30
        ]);
31
        $definition->setArguments([new Reference($config['id'])]);
32
33
        return $definition;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function getKeySet()
40
    {
41
        return 'public_jwkset';
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function addConfiguration(NodeDefinition $node)
48
    {
49
        parent::addConfiguration($node);
50
        $node
51
            ->children()
52
                ->scalarNode('id')
53
                    ->info('ID of the JWKSet to use.')
54
                    ->isRequired()
55
                ->end()
56
            ->end();
57
    }
58
}
59