Failed Conditions
Push — master ( cccd95...989cb2 )
by Florent
03:57
created

OAuth2FrameworkSecurityBundle   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 24
c 0
b 0
f 0
wmc 2
lcom 0
cbo 4
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainerExtension() 0 4 1
A build() 0 10 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\SecurityBundle;
15
16
use OAuth2Framework\SecurityBundle\DependencyInjection\Compiler\AccessTokenHandlerCompilerPass;
17
use OAuth2Framework\SecurityBundle\DependencyInjection\Compiler\SecurityAnnotationCheckerCompilerPass;
18
use OAuth2Framework\SecurityBundle\DependencyInjection\OAuth2Extension;
19
use OAuth2Framework\SecurityBundle\Security\Factory\OAuth2SecurityFactory;
20
use Symfony\Component\DependencyInjection\ContainerBuilder;
21
use Symfony\Component\HttpKernel\Bundle\Bundle;
22
23
class OAuth2FrameworkSecurityBundle extends Bundle
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getContainerExtension()
29
    {
30
        return new OAuth2Extension('oauth2_security');
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function build(ContainerBuilder $container)
37
    {
38
        parent::build($container);
39
        /** @var \Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension $extension */
40
        $extension = $container->getExtension('security');
41
        $extension->addSecurityListenerFactory(new OAuth2SecurityFactory());
42
43
        $container->addCompilerPass(new SecurityAnnotationCheckerCompilerPass());
44
        $container->addCompilerPass(new AccessTokenHandlerCompilerPass());
45
    }
46
}
47