Failed Conditions
Push — master ( b0c3d3...09f0bf )
by Florent
10:07 queued 07:50
created

AbstractJWKSetSource   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 17
rs 10
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
16
abstract class AbstractJWKSetSource
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function create(ContainerBuilder $container, $id, array $config)
22
    {
23
        parent::create($container, $id, $config);
24
        
25
        if ($config['is_shared']) {
26
            $controller_definition = new Definition('SpomkyLabs\JoseBundle\Controller\JWKSetController');
27
            $controller_definition->setFactory([new Reference('jose.controller.jwkset_controllery_factory'), 'createJWKSetController']);
28
            $controller_definition->setArguments([new Reference($id]);
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected ']', expecting ',' or ')'
Loading history...
29
            $container->setDefinition('jose.controller.'.$id, $controller_definition);
30
        }
31
    }
32
    
33
    /**
34
     * @param \Symfony\Component\Config\Definition\Builder\NodeDefinition $node
35
     */
36
    public function addConfiguration(NodeDefinition $node)
37
    {
38
        parent::addConfiguration($node);
39
        $node
40
            ->children()
41
                ->booleanNode('is_shared')
42
                    ->info('If true, a controller will be created to ease the JWKSet to be shared.')
43
                    ->defaultFalse()
44
                ->end()
45
            ->end();
46
    }
47
}
48