Completed
Pull Request — master (#154)
by Arnaud
04:40
created

HomeAction::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace LAG\AdminBundle\Controller;
4
5
use LAG\AdminBundle\Configuration\ApplicationConfiguration;
6
use LAG\AdminBundle\Configuration\ApplicationConfigurationStorage;
7
use LAG\AdminBundle\Event\Events;
8
use LAG\AdminBundle\Event\Events\OldBuildMenuEvent;
9
use Symfony\Component\HttpFoundation\Response;
10
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
11
use Twig\Environment;
12
13
class HomeAction
14
{
15
    /**
16
     * @var Environment
17
     */
18
    private $twig;
19
20
    /**
21
     * @var ApplicationConfiguration
22
     */
23
    private $applicationConfiguration;
24
25
    /**
26
     * HomeAction constructor.
27
     */
28
    public function __construct(
29
        Environment $twig,
30
        ApplicationConfigurationStorage $applicationConfigurationStorage
31
    ) {
32
        $this->twig = $twig;
33
        $this->applicationConfiguration = $applicationConfigurationStorage->getConfiguration();
34
    }
35
36
    /**
37
     * @return Response
38
     */
39
    public function __invoke()
40
    {
41
        $content = $this->twig->render($this->applicationConfiguration->getParameter('homepage_template'));
42
43
        return new Response($content);
44
    }
45
}
46