| Total Complexity | 4 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 4 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 9 | class ExcelRenderer extends Renderer |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | private $excelExportClass = ViewExcelExport::class; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Set the `ExcelExport` class to be used to render the Excel file. |
||
| 18 | * |
||
| 19 | * @param string $exportClass |
||
| 20 | * @return $this |
||
| 21 | */ |
||
| 22 | public function setExcelExport(string $exportClass): self |
||
| 23 | { |
||
| 24 | $this->excelExportClass = $exportClass; |
||
| 25 | |||
| 26 | return $this; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Render the content to a exportable object. |
||
| 31 | * |
||
| 32 | * @return object |
||
| 33 | */ |
||
| 34 | protected function render(): object |
||
| 35 | { |
||
| 36 | return new $this->excelExportClass($this->content); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Retrieve in an Exporter instance created from the $exportable. |
||
| 41 | * |
||
| 42 | * @param $exportable |
||
| 43 | * @return ExcelExporter |
||
| 44 | */ |
||
| 45 | protected function exporter($exportable): ExcelExporter |
||
| 46 | { |
||
| 47 | return new ExcelExporter($exportable); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Load renderable content to an Exporter instance and render the output. |
||
| 52 | * |
||
| 53 | * @return Exporter|ExcelExporter |
||
| 54 | */ |
||
| 55 | public function handle(): ExcelExporter |
||
| 58 | } |
||
| 59 | } |
||
| 60 |