public function exportCommand($siteNode = null, $tidy = true, $filename = null, $packageKey = null, $nodeTypeFilter = null)
{
if ($siteNode === null) {
$sites = $this->siteRepository->findAll()->toArray();
} else {
$sites = $this->siteRepository->findByNodeName($siteNode)->toArray();
}
if (count($sites) === 0) {
$this->outputLine('<error>No site for exporting found</error>');
$this->quit(1);
}
if ($packageKey !== null) {
$this->siteExportService->exportToPackage($sites, $tidy, $packageKey, $nodeTypeFilter);
if ($siteNode !== null) {
$this->outputLine('The site "%s" has been exported to package "%s".', array($siteNode, $packageKey));
} else {
$this->outputLine('All sites have been exported to package "%s".', array($packageKey));
}
} elseif ($filename !== null) {
$this->siteExportService->exportToFile($sites, $tidy, $filename, $nodeTypeFilter);
if ($siteNode !== null) {
$this->outputLine('The site "%s" has been exported to "%s".', array($siteNode, $filename));
} else {
$this->outputLine('All sites have been exported to "%s".', array($filename));
}
} else {
$this->output($this->siteExportService->export($sites, $tidy, $nodeTypeFilter));
}
}