Test Failed
Push — master ( d0a8b0...152ea2 )
by Jean-Bernard
01:48
created

ComponentKernel::configureContainer()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 38
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 22
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the Symfony-Util package.
5
 *
6
 * (c) Jean-Bernard Addor
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
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
13
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
14
use Symfony\Bundle\TwigBundle\TwigBundle;
15
use Symfony\Component\Config\Loader\LoaderInterface;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\HttpKernel\Kernel;
18
use Symfony\Component\Routing\RouteCollectionBuilder;
19
use Symfony\Component\Templating\EngineInterface;
20
21
class ComponentKernel extends Kernel
22
{
23
    use MicroKernelTrait;
24
25
    public function registerBundles()
26
    {
27
        return [
28
            new FrameworkBundle(),
29
            // new TwigBundle(),
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...
30
        ];
31
    }
32
33
    protected function configureRoutes(RouteCollectionBuilder $routes)
34
    {
35
        $routes->add('/', SymfonyUtil\Controller\EngineAsArgumentController::class, 'index');
36
    }
37
38
    protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
39
    {
40
        // https://symfony.com/doc/current/service_container.html
41
        $c->autowire(Symfony\Component\Templating\TemplateNameParser::class)
42
            ->setAutoconfigured(true)
43
            ->setPublic(false);
44
45
        $c->autowire(Twig_Loader_Array::class, Twig_Loader_Array::class)
46
            ->setArgument('$templates', ['index.html.twig' => 'Hello World!'])
47
            ->setAutoconfigured(true)
48
            ->setPublic(false);
49
50
        $c->autowire(Twig_Environment::class, Twig_Environment::class)
51
            ->setAutoconfigured(true)
52
            ->setPublic(false);
53
54
        $c->autowire(TwigEngine::class, TwigEngine::class)
55
            ->setAutoconfigured(true)
56
            ->setShared(true) // not needed: default
57
            ->setPublic(false);
58
        $c->setAlias(EngineInterface::class, TwigEngine::class)
59
60
        //Controllers
61
        $c->autowire(SymfonyUtil\Controller\EngineAsArgumentController::class)
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_VARIABLE
Loading history...
62
            ->setAutoconfigured(true)
63
            ->addTag('controller.service_arguments')
64
            ->setPublic(false);
65
66
        // Extensions
67
        $c->loadFromExtension('framework', [
68
            'secret' => 'NotSecret', // What about use $ uuid -v4  or $ uuidgen
69
            'test' => in_array($this->getEnvironment(), ['test'], true), // test.client service for eg. PHPUnit
70
            // 'templating' => ['engines' => 'twig'],
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% 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...
71
        ]);
72
        // $c->loadFromExtension('twig', [
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% 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...
73
        //     'debug' => true,
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
74
        //     'paths' => ['%kernel.project_dir%/tests/templates'],
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% 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...
75
        // ]);
76
    }
77
}
78