| Total Complexity | 4 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 |
||
| 52 | } |
||
| 53 | } |
||
| 54 |