feat: wire file transport services
This commit is contained in:
@@ -8,9 +8,13 @@
|
||||
namespace WPContentSync;
|
||||
|
||||
use WPContentSync\Admin\AdminPage;
|
||||
use WPContentSync\Admin\FileImportController;
|
||||
use WPContentSync\Logging\LoggerInterface;
|
||||
use WPContentSync\Logging\OptionLogger;
|
||||
use WPContentSync\Package\PackageValidator;
|
||||
use WPContentSync\Settings\SettingsRepository;
|
||||
use WPContentSync\Transport\FileTransportInterface;
|
||||
use WPContentSync\Transport\JsonFileTransport;
|
||||
use WPContentSync\Url\MetadataUrlTransformer;
|
||||
use WPContentSync\Url\UrlTransformer;
|
||||
|
||||
@@ -54,6 +58,32 @@ final class Plugin {
|
||||
}
|
||||
);
|
||||
|
||||
$container->factory(
|
||||
PackageValidator::class,
|
||||
static function (): PackageValidator {
|
||||
return new PackageValidator();
|
||||
}
|
||||
);
|
||||
|
||||
$container->factory(
|
||||
FileTransportInterface::class,
|
||||
static function () use ( $container ): FileTransportInterface {
|
||||
return new JsonFileTransport(
|
||||
$container->get( PackageValidator::class )
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
$container->factory(
|
||||
FileImportController::class,
|
||||
static function () use ( $container ): FileImportController {
|
||||
return new FileImportController(
|
||||
$container->get( FileTransportInterface::class ),
|
||||
$container->get( LoggerInterface::class )
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
$container->factory(
|
||||
AdminPage::class,
|
||||
static function () use ( $container ): AdminPage {
|
||||
@@ -71,6 +101,10 @@ final class Plugin {
|
||||
/** @var AdminPage $admin_page */
|
||||
$admin_page = $this->container->get( AdminPage::class );
|
||||
|
||||
/** @var FileImportController $file_import_controller */
|
||||
$file_import_controller = $this->container->get( FileImportController::class );
|
||||
|
||||
$admin_page->register();
|
||||
$file_import_controller->register();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user