Test Failed
Push — master ( 859de1...a4bbbb )
by Jean-Bernard
02:59
created

ComponentKernel::configureRoutes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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
20
class ComponentKernel extends Kernel
21
{
22
    use MicroKernelTrait;
23
24
    public function registerBundles()
25
    {
26
        return [
27
            new FrameworkBundle(),
28
            // 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...
29
        ];
30
    }
31
32
    protected function configureRoutes(RouteCollectionBuilder $routes)
33
    {
34
        $routes->add('/', SymfonyUtil\Controller\EngineAsArgumentController::class, 'index');
35
    }
36
37
    protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
0 ignored issues
show
Unused Code introduced by
The parameter $loader is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        // https://symfony.com/doc/current/service_container.html
40
        $c->autowire(Symfony\Component\Templating\TemplateNameParser::class)
41
            ->setAutoconfigured(true)
42
            ->setPublic(false);
43
44
        $c->autowire(Twig_Loader_Array::class)
45
            ->setArgument('$templates', ['index.html.twig' => 'Hello World!'])
46
            ->setAutoconfigured(true)
47
            ->setPublic(false);
48
49
        //Controllers
50
        $c->autowire(SymfonyUtil\Controller\EngineAsArgumentController::class)
51
            ->setAutoconfigured(true)
52
            ->addTag('controller.service_arguments')
53
            ->setPublic(false);
54
55
        // Extensions
56
        $c->loadFromExtension('framework', [
57
            'secret' => 'NotSecret', // What about use $ uuid -v4  or $ uuidgen
58
            'test' => in_array($this->getEnvironment(), ['test'], true), // test.client service for eg. PHPUnit
59
            // '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...
60
        ]);
61
        // $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...
62
        //     '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...
63
        //     '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...
64
        // ]);
65
    }
66
}
67