Completed
Push — master ( 35e232...de1564 )
by Florent
02:34
created

RandomOctKey   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 33
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createNewKey() 0 7 1
A getKey() 0 4 1
A addConfiguration() 0 8 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 Assert\Assertion;
15
use Jose\Factory\JWKFactory;
16
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
use Symfony\Component\DependencyInjection\Definition;
19
use Symfony\Component\DependencyInjection\Reference;
20
21
class RandomOctKey extends RandomKey
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function createNewKey(array $config)
27
    {
28
        $size = $config['size'];
29
        $values = $config['additional_values'];
30
31
        return JWKFactory::createOctKey($size, $values)->getAll();
0 ignored issues
show
Bug introduced by
The method createOctKey() does not seem to exist on object<Jose\Factory\JWKFactory>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function getKey()
38
    {
39
        return 'oct';
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function addConfiguration(NodeDefinition $node)
46
    {
47
        $node
48
            ->children()
49
                ->integerNode('size')->isRequired()->end()
50
            ->end();
51
        parent::addConfiguration($node);
52
    }
53
}
54