2026-07-06 03:42:24 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Modules\Core\MigrateImport;
|
|
|
|
|
|
2026-07-10 15:19:48 +03:00
|
|
|
use Modules\Core\MigrateImport\JudgeMe\JudgeMeExportImporter;
|
2026-07-06 03:42:24 +03:00
|
|
|
use Modules\Core\MigrateImport\Shopify\ShopifyExportImporter;
|
|
|
|
|
|
|
|
|
|
class ImporterFactory
|
|
|
|
|
{
|
|
|
|
|
public static function make(ImportSpec $spec): Importer
|
|
|
|
|
{
|
|
|
|
|
return match ([$spec->source, $spec->type]) {
|
2026-07-10 15:19:48 +03:00
|
|
|
['shopify', 'export'] => new ShopifyExportImporter,
|
2026-07-06 03:42:24 +03:00
|
|
|
// ["shopify", "api"] => new ShopifyApiImporter(),
|
2026-07-10 15:19:48 +03:00
|
|
|
['judgeme', 'export'] => new JudgeMeExportImporter,
|
2026-07-06 03:42:24 +03:00
|
|
|
// ["woocommerce", "export"] => new WooCommerceExportImporter(),
|
|
|
|
|
// ["woocommerce", "api"] => new WooCommerceApiImporter(),
|
|
|
|
|
default => throw new \InvalidArgumentException(
|
|
|
|
|
"No importer available for source \"{$spec->source}\" with type \"{$spec->type}\".",
|
|
|
|
|
),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|