AbstractMyPoseoBundleTestKernel   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A registerBundles() 0 7 1
A configureContainer() 0 22 1
1
<?php
2
3
namespace Tristanbes\MyPoseoBundle\Tests;
4
5
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
6
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\HttpKernel\Kernel;
9
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
10
use Symfony\Component\Routing\RouteCollectionBuilder;
11
use Tristanbes\MyPoseoBundle\MyPoseoBundle;
12
13
abstract class AbstractMyPoseoBundleTestKernel extends Kernel
14
{
15
    use MicroKernelTrait;
16
17
    public function __construct()
18
    {
19
        parent::__construct('test', true);
20
    }
21
22
    public function registerBundles(): iterable
23
    {
24
        return [
25
            new FrameworkBundle(),
26
            new MyPoseoBundle(),
27
        ];
28
    }
29
30
    protected function configureContainer(ContainerBuilder $containerBuilder): void
31
    {
32
        $containerBuilder->loadFromExtension('framework', [
33
            'secret' => 'my-secret',
34
            'test'   => true,
35
            'router' => [
36
                'utf8' => true,
37
            ],
38
        ]);
39
40
        $containerBuilder->loadFromExtension('my_poseo', [
41
            'api' => [
42
                'key'         => 'my_key',
43
                'http_client' => null,
44
                'type'        => [
45
                    'search' => [
46
                        'base_url' => 'http://api.myposeo.com/m/apiv2',
47
                    ],
48
                ],
49
            ],
50
        ]);
51
    }
52
}
53
54
if (AbstractMyPoseoBundleTestKernel::VERSION_ID >= 50100) { // @phpstan-ignore-line
55
    class MyPoseoBundleTestKernel extends AbstractMyPoseoBundleTestKernel
56
    {
57
        protected function configureRoutes(RoutingConfigurator $routes): void
58
        {
59
        }
60
    }
61
} else { // @phpstan-ignore-line
62
    class MyPoseoBundleTestKernel extends AbstractMyPoseoBundleTestKernel
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type Tristanbes\MyPoseoBundle...MyPoseoBundleTestKernel has been defined more than once; this definition is ignored, only the first definition in this file (L55-60) is considered.

This check looks for classes that have been defined more than once in the same file.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
63
    {
64
        protected function configureRoutes(RouteCollectionBuilder $routes): void
65
        {
66
        }
67
    }
68
}
69