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

AppKernel::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 12
rs 9.4285
cc 1
eloc 7
nc 1
nop 3
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