support different formats in user timesheet exports (#1222)

This commit is contained in:
Kevin Papst
2019-11-08 16:10:38 +01:00
committed by GitHub
parent 0705c26513
commit fa1c79e15c
75 changed files with 1872 additions and 951 deletions

View File

@@ -9,22 +9,17 @@
namespace App\Export;
class ServiceExport
final class ServiceExport
{
/**
* @var RendererInterface[]
*/
protected $renderer = [];
private $renderer = [];
/**
* @param RendererInterface[] $renderer
* @var TimesheetExportInterface[]
*/
public function __construct(iterable $renderer)
{
foreach ($renderer as $render) {
$this->addRenderer($render);
}
}
private $exporter = [];
public function addRenderer(RendererInterface $renderer): ServiceExport
{
@@ -51,4 +46,30 @@ class ServiceExport
return null;
}
public function addTimesheetExporter(TimesheetExportInterface $exporter): ServiceExport
{
$this->exporter[] = $exporter;
return $this;
}
/**
* @return TimesheetExportInterface[]
*/
public function getTimesheetExporter(): array
{
return $this->exporter;
}
public function getTimesheetExporterById(string $id): ?TimesheetExportInterface
{
foreach ($this->exporter as $exporter) {
if ($exporter->getId() === $id) {
return $exporter;
}
}
return null;
}
}