Failed Conditions
Push — master ( b0e939...893034 )
by Florent
19:07
created

getContainerExtension()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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\ServerBundle;
15
16
use OAuth2Framework\ServerBundle\DependencyInjection\OAuth2FrameworkExtension;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
use Symfony\Component\HttpKernel\Bundle\Bundle;
19
20
class OAuth2FrameworkServerBundle extends Bundle
21
{
22
    /**
23
     * @var Component\Component[]
24
     */
25
    private $components = [];
26
27
    /**
28
     * JoseFrameworkBundle constructor.
29
     */
30
    public function __construct()
31
    {
32
        foreach ($this->getComponents() as $component) {
33
            $this->components[$component->name()] = $component;
34
        }
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getContainerExtension()
41
    {
42
        return new OAuth2FrameworkExtension('oauth2_server', $this->components);
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function build(ContainerBuilder $container)
49
    {
50
        parent::build($container);
51
        foreach ($this->components as $component) {
52
            $component->build($container);
53
        }
54
    }
55
56
    /**
57
     * @return Component\Component[]
58
     */
59
    private function getComponents(): array
60
    {
61
        return [
62
            new Component\Core\TrustedIssuerSource(),
63
            new Component\Core\ClientSource(),
64
            new Component\Core\AccessTokenSource(),
65
            new Component\Core\UserAccountSource(),
66
            new Component\Core\ServicesSource(),
67
            new Component\Core\ResourceServerSource(),
68
            new Component\ClientRule\ClientRuleSource(),
69
            new Component\ClientAuthentication\ClientAuthenticationSource(),
70
71
            new Component\Scope\ScopeSource(),
72
            new Component\TokenType\TokenTypeSource(),
73
            new Component\Endpoint\EndpointSource(),
74
            new Component\Grant\GrantSource(),
75
            new Component\OpenIdConnect\OpenIdConnectSource(),
76
77
            /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
78
            new Component\HttpSource(),
79
            new Component\KeySet(),*/
80
        ];
81
    }
82
}
83