GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

TableRenderer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
c 0
b 0
f 0
dl 0
loc 34
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A render() 0 19 2
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusReportPlugin\Renderer;
6
7
use Odiseo\SyliusReportPlugin\DataFetcher\Data;
8
use Odiseo\SyliusReportPlugin\Form\Type\Renderer\TableConfigurationType;
9
use Odiseo\SyliusReportPlugin\Model\ReportInterface;
10
use Twig\Environment;
11
12
/**
13
 * @author Mateusz Zalewski <[email protected]>
14
 * @author Łukasz Chruściel <[email protected]>
15
 * @author Diego D'amico <[email protected]>
16
 * @author Rimas Kudelis <[email protected]>
17
 */
18
class TableRenderer implements RendererInterface
19
{
20
    private Environment $templating;
21
22
    public function __construct(Environment $templating)
23
    {
24
        $this->templating = $templating;
25
    }
26
27
    public function render(ReportInterface $report, Data $data): string
28
    {
29
        if ([] !== $data->getData()) {
30
            $data = [
31
                'report' => $report,
32
                'values' => $data->getData(),
33
                'labels' => $data->getLabels(),
34
            ];
35
36
            $rendererConfiguration = $report->getRendererConfiguration();
37
38
            return $this->templating->render($rendererConfiguration['template'], [
39
                'data' => $data,
40
                'configuration' => $rendererConfiguration,
41
            ]);
42
        }
43
44
        return $this->templating->render('@OdiseoSyliusReportPlugin/noDataTemplate.html.twig', [
45
            'report' => $report,
46
        ]);
47
    }
48
49
    public function getType(): string
50
    {
51
        return TableConfigurationType::class;
52
    }
53
}
54