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

HomeAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 31
ccs 0
cts 7
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A __invoke() 0 5 1
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