Completed
Push — main ( f9cf94...70e9b4 )
by Niels
23s queued 16s
created

NijensOpenapiBundle.php$0 ➔ getSymfonyVersion()   A

Complexity

Conditions 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
dl 0
loc 14
rs 9.7998

2 Methods

Rating   Name   Duplication   Size   Complexity  
A NijensOpenapiBundle.php$0 ➔ registerBundles() 0 3 1
A NijensOpenapiBundle.php$0 ➔ registerContainerConfiguration() 0 2 1
1
<?php
2
3
/*
4
 * This file is part of the OpenapiBundle package.
5
 *
6
 * (c) Niels Nijens <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Nijens\OpenapiBundle;
13
14
use Symfony\Component\Config\Loader\LoaderInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\HttpKernel\Bundle\Bundle;
17
use Symfony\Component\HttpKernel\Kernel;
18
use Symfony\Component\Serializer\DependencyInjection\SerializerPass;
19
20
/**
21
 * OpenapiBundle.
22
 *
23
 * @author Niels Nijens <[email protected]>
24
 */
25
class NijensOpenapiBundle extends Bundle
26
{
27
    public function build(ContainerBuilder $container): void
28
    {
29
        parent::build($container);
30
31
        $container->addCompilerPass(
32
            new SerializerPass('nijens_openapi.serializer', 'nijens_openapi.serializer.normalizer')
33
        );
34
    }
35
36
    public static function getSymfonyVersion(): int
37
    {
38
        $kernel = new class('symfony_version', false) extends Kernel {
39
            public function registerBundles(): iterable
40
            {
41
                return [];
42
            }
43
44
            public function registerContainerConfiguration(LoaderInterface $loader): void
45
            {
46
            }
47
        };
48
49
        return $kernel::VERSION_ID;
50
    }
51
}
52