RandomOctKey::addConfiguration()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 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\JWKSource;
13
14
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
15
16
final class RandomOctKey extends RandomKey
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    protected function getKeyConfig(array $config)
22
    {
23
        $values = $config['key_configuration'];
24
        $values['kty'] = 'oct';
25
        $values['size'] = $config['size'];
26
27
        return $values;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function getKey()
34
    {
35
        return 'oct';
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function addConfiguration(NodeDefinition $node)
42
    {
43
        $node
44
            ->children()
45
                ->integerNode('size')->isRequired()->end()
46
            ->end();
47
        parent::addConfiguration($node);
48
    }
49
}
50