Completed
Push — master ( 0f478c...b73fd3 )
by Kamil
14:27 queued 08:29
created

Kernel::configureContainer()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 71

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 71
rs 8.6327
c 0
b 0
f 0
cc 1
nc 1
nop 2

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
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
declare(strict_types=1);
13
14
namespace Sylius\Bundle\UiBundle\Tests\Functional;
15
16
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
17
use Symfony\Component\Config\Loader\LoaderInterface;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
20
use Symfony\Component\Routing\RouteCollectionBuilder;
21
22
final class Kernel extends HttpKernel
23
{
24
    use MicroKernelTrait;
25
26
    public function registerBundles(): array
27
    {
28
        return [
29
            new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
30
            new \Symfony\Bundle\SecurityBundle\SecurityBundle(),
31
            new \Symfony\Bundle\TwigBundle\TwigBundle(),
32
            new \Sonata\BlockBundle\SonataBlockBundle(),
33
            new \Sylius\Bundle\UiBundle\SyliusUiBundle(),
34
        ];
35
    }
36
37
    protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
38
    {
39
        $containerBuilder->loadFromExtension('framework', [
40
            'secret' => 'S0ME_SECRET',
41
            'templating' => [
42
                'engines' => ['twig'],
43
            ],
44
        ]);
45
46
        $containerBuilder->loadFromExtension('security', ['firewalls' => ['main' => ['anonymous' => null]]]);
47
48
        $containerBuilder->loadFromExtension(
49
            'sonata_block',
50
            ['blocks' => ['sonata.block.service.template' => ['settings' => ['context' => null]]]]
51
        );
52
53
        $containerBuilder->loadFromExtension('sylius_ui', ['events' => [
54
            'first_event' => [
55
                'blocks' => [
56
                    'third' => ['template' => 'blocks/txt/third.txt.twig', 'priority' => -5],
57
                    'first' => ['template' => 'blocks/txt/first.txt.twig', 'priority' => 5],
58
                    'second' => 'blocks/txt/second.txt.twig',
59
                ],
60
            ],
61
            'second_event' => [
62
                'blocks' => [
63
                    'context' => 'blocks/txt/context.txt.twig',
64
                ],
65
            ],
66
            'event' => [
67
                'blocks' => [
68
                    'first' => ['template' => 'blocks/html/first.html.twig', 'priority' => 5],
69
                    'context' => ['template' => 'blocks/html/context.html.twig', 'priority' => -5],
70
                ],
71
            ],
72
            'context_template_block' => [
73
                'blocks' => [
74
                    'block' => [
75
                        'template' => 'blocks/contextTemplateBlock/block.txt.twig',
76
                        'context' => [
77
                            'option1' => 'foo',
78
                            'option2' => 'bar',
79
                        ],
80
                    ],
81
                ],
82
            ],
83
            'multiple_events_generic' => [
84
                'blocks' => [
85
                    'first' => [
86
                        'template' => 'blocks/multipleEvents/genericFirst.txt.twig',
87
                    ],
88
                    'second' => [
89
                        'template' => 'blocks/multipleEvents/genericSecond.txt.twig',
90
                        'context' => ['value' => 13],
91
                    ],
92
                ],
93
            ],
94
            'multiple_events_specific' => [
95
                'blocks' => [
96
                    'specific' => [
97
                        'template' => 'blocks/multipleEvents/specific.txt.twig',
98
                        'priority' => 3,
99
                    ],
100
                    'second' => [
101
                        'context' => ['value' => 42],
102
                        'priority' => 5,
103
                    ],
104
                ],
105
            ],
106
        ]]);
107
    }
108
109
    protected function configureRoutes(RouteCollectionBuilder $routes): void
110
    {
111
    }
112
}
113