22 lines
725 B
PHP
22 lines
725 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Modules\Core\MigrateImport;
|
||
|
|
|
||
|
|
use Modules\Core\MigrateImport\Shopify\ShopifyExportImporter;
|
||
|
|
|
||
|
|
class ImporterFactory
|
||
|
|
{
|
||
|
|
public static function make(ImportSpec $spec): Importer
|
||
|
|
{
|
||
|
|
return match ([$spec->source, $spec->type]) {
|
||
|
|
["shopify", "export"] => new ShopifyExportImporter(),
|
||
|
|
// ["shopify", "api"] => new ShopifyApiImporter(),
|
||
|
|
// ["woocommerce", "export"] => new WooCommerceExportImporter(),
|
||
|
|
// ["woocommerce", "api"] => new WooCommerceApiImporter(),
|
||
|
|
default => throw new \InvalidArgumentException(
|
||
|
|
"No importer available for source \"{$spec->source}\" with type \"{$spec->type}\".",
|
||
|
|
),
|
||
|
|
};
|
||
|
|
}
|
||
|
|
}
|