Failed Conditions
Push — ng ( 57a3a2...d2fe45 )
by Florent
03:39
created

ImplicitSource   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 42
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A name() 0 4 1
A load() 0 7 2
A getNodeDefinition() 0 8 1
A prepend() 0 5 1
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\Grant\Implicit;
15
16
use OAuth2Framework\Bundle\DependencyInjection\Component\Component;
17
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
18
use Symfony\Component\Config\FileLocator;
19
use Symfony\Component\DependencyInjection\ContainerBuilder;
20
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
21
22
final class ImplicitSource implements Component
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function name(): string
28
    {
29
        return 'implicit';
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function load(array $configs, ContainerBuilder $container)
36
    {
37
        if ($configs['grant']['implicit']['enabled']) {
38
            $loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../../../../Resources/config/grant'));
39
            $loader->load('implicit.php');
40
        }
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function getNodeDefinition(NodeDefinition $node)
47
    {
48
        $node->children()
49
            ->arrayNode('implicit')
50
                ->canBeEnabled()
51
            ->end()
52
        ->end();
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function prepend(ContainerBuilder $container, array $config): array
59
    {
60
        //Nothing to do
61
        return [];
62
    }
63
}
64