Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | public function resolve(ReportInterface $report): string |
||
34 | { |
||
35 | $reportConfiguration = $report->getReportConfiguration(); |
||
36 | if (null === $reportConfiguration) { |
||
37 | throw new \RuntimeException(sprintf('No report configuration associated with report %s', $report->getId())); |
||
38 | } |
||
39 | |||
40 | $template = $this->twig->load($reportConfiguration->getTemplate()); |
||
41 | |||
42 | if (!$template->hasBlock('extension')) { |
||
43 | throw new InvalidArgumentException(sprintf( |
||
44 | 'The block "extension" is not present in the template %s', |
||
45 | $reportConfiguration->getTemplate() |
||
46 | )); |
||
47 | } |
||
48 | |||
49 | $extension = $template->renderBlock('extension'); |
||
50 | |||
51 | return 'stock-movement-report-' . $report->getId() . '.' . $extension; |
||
52 | } |
||
54 |