exportServiceFactory = $exportServiceFactory; $this->importServiceFactory = $importServiceFactory; } /** @return ABJ_404_Solution_ExportService */ private function getExportService() { if ($this->exportService === null) { $this->exportService = ($this->exportServiceFactory)(); } return $this->exportService; } /** @return ABJ_404_Solution_ImportService */ private function getImportService() { if ($this->importService === null) { $this->importService = ($this->importServiceFactory)(); } return $this->importService; } /** @return string */ function getExportFilename(string $format = 'native'): string { return $this->getExportService()->getExportFilename($format); } /** @return void */ function doExport(): void { $this->getExportService()->doExport(); } /** * @param string $sourceFile Native export file path. * @param string $destinationFile Output file path. * @return string Empty string on success, error message otherwise. */ function convertExportCsvToRedirectionFormat($sourceFile, $destinationFile) { return $this->getExportService()->convertExportCsvToRedirectionFormat($sourceFile, $destinationFile); } /** @return string */ function doImportFile(): string { return $this->getImportService()->doImportFile(); } /** * @param array $dataArray * @param bool $dryRun * @return array */ function loadDataArrayFromFile(array $dataArray, bool $dryRun = false): array { return $this->getImportService()->loadDataArrayFromFile($dataArray, $dryRun); } /** @return array */ function splitCsvLine(string $line): array { return $this->getImportService()->splitCsvLine($line); } /** * @param array $columns * @return bool */ function isCompatibleImportHeaderRow(array $columns): bool { return $this->getImportService()->isCompatibleImportHeaderRow($columns); } /** * @param array $columns * @return array */ function normalizeImportHeaders(array $columns): array { $result = $this->getImportService()->normalizeImportHeaders($columns); return array_map(function ($v) { return is_string($v) ? $v : ''; }, $result); } /** * @param array $row * @param array $normalizedHeaders * @return array */ function mapImportRowByHeaders(array $row, array $normalizedHeaders): array { return $this->getImportService()->mapImportRowByHeaders($row, $normalizedHeaders); } /** * @param array $columns * @return string */ function detectImportFormatFromHeaders(array $columns): string { return $this->getImportService()->detectImportFormatFromHeaders($columns); } }