Failed Conditions
Push — ng ( 75309d...bc6f2d )
by Florent
08:22
created

OAuth2ResponseSource   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A name() 0 4 1
A load() 0 7 1
A getNodeDefinition() 0 4 1
A build() 0 4 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\Component\Core;
15
16
use OAuth2Framework\Bundle\Component\Component;
17
use OAuth2Framework\Component\Core\Response\Factory\ResponseFactory;
18
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
19
use Symfony\Component\Config\FileLocator;
20
use Symfony\Component\DependencyInjection\ContainerBuilder;
21
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
22
23
class OAuth2ResponseSource implements Component
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function name(): string
29
    {
30
        return 'oauth2_response';
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function load(array $configs, ContainerBuilder $container)
37
    {
38
        $container->registerForAutoconfiguration(ResponseFactory::class)->addTag('oauth2_server_response_factory');
39
40
        $loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../../Resources/config/core'));
41
        $loader->load('oauth2_response.php');
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function getNodeDefinition(NodeDefinition $node)
48
    {
49
        //Nothing to do
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function build(ContainerBuilder $container)
56
    {
57
        $container->addCompilerPass(new ResponseFactoryCompilerPass());
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function prepend(ContainerBuilder $container, array $config): array
64
    {
65
        //Nothing to do
66
        return [];
67
    }
68
}
69