Completed
Push — refactoring-session ( a6dec9 )
by Kamil
06:43
created

StatisticsController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Sylius\Bundle\AdminBundle\Controller\Dashboard;
6
7
use Sylius\Component\Core\Dashboard\DashboardStatisticsProviderInterface;
8
use Sylius\Component\Core\Model\ChannelInterface;
9
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
10
use Symfony\Component\HttpFoundation\Response;
11
12
final class StatisticsController
13
{
14
    /** @var EngineInterface */
15
    private $templatingEngine;
16
17
    /** @var DashboardStatisticsProviderInterface */
18
    private $statisticsProvider;
19
20
    public function __construct(
21
        EngineInterface $templatingEngine,
22
        DashboardStatisticsProviderInterface $statisticsProvider
23
    ) {
24
        $this->templatingEngine = $templatingEngine;
25
        $this->statisticsProvider = $statisticsProvider;
26
    }
27
28
    public function __invoke(ChannelInterface $channel): Response
29
    {
30
        return $this->templatingEngine->renderResponse(
31
            '@SyliusAdmin/Dashboard/Statistics/_template.html.twig',
32
            ['statistics' => $this->statisticsProvider->getStatisticsForChannel($channel)]
33
        );
34
    }
35
}
36