Completed
Push — master ( 3c5828...866487 )
by Dorian
02:10
created

AppKernel   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6
Metric Value
wmc 2
lcom 0
cbo 6
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getExtensions() 0 9 1
A handle() 0 12 1
1
<?php
2
3
namespace Application;
4
5
use Gnutix\StarWarsLibrary\DependencyInjection\Extension as StarWarsLibraryExtension;
6
7
use Symfony\Component\HttpFoundation\Request;
8
use Symfony\Component\HttpFoundation\Response;
9
10
use Gnutix\Kernel\TwigAwareKernel;
11
12
/**
13
 * Application Kernel
14
 */
15
class AppKernel extends TwigAwareKernel
16
{
17
    /**
18
     * {@inheritDoc}
19
     */
20
    protected function getExtensions()
21
    {
22
        return array_merge(
23
            parent::getExtensions(),
24
            array(
25
                new StarWarsLibraryExtension
26
            )
27
        );
28
    }
29
30
    /**
31
     * {@inheritDoc}
32
     */
33
    public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
34
    {
35
        return new Response(
36
            $this->container->get('twig')->render(
37
                'index.html.twig',
38
                array(
39
                    'request' => $request,
40
                    'showLanguages' => $request->query->get('show-languages'),
41
                )
42
            )
43
        );
44
    }
45
}
46