Automattic\WooCommerce\Blocks\Domain

Bootstrap::register_dependencies()protectedWC 1.0

Register core dependencies with the container.

Метод класса: Bootstrap{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->register_dependencies();

Код Bootstrap::register_dependencies() WC 8.9.0

protected function register_dependencies() {
	$this->container->register(
		FeatureGating::class,
		function () {
			return new FeatureGating();
		}
	);
	$this->container->register(
		AssetApi::class,
		function ( Container $container ) {
			return new AssetApi( $container->get( Package::class ) );
		}
	);
	$this->container->register(
		AssetDataRegistry::class,
		function( Container $container ) {
			return new AssetDataRegistry( $container->get( AssetApi::class ) );
		}
	);
	$this->container->register(
		AssetsController::class,
		function( Container $container ) {
			return new AssetsController( $container->get( AssetApi::class ) );
		}
	);
	$this->container->register(
		PaymentMethodRegistry::class,
		function() {
			return new PaymentMethodRegistry();
		}
	);
	$this->container->register(
		Installer::class,
		function () {
			return new Installer();
		}
	);
	$this->container->register(
		BlockTypesController::class,
		function ( Container $container ) {
			$asset_api           = $container->get( AssetApi::class );
			$asset_data_registry = $container->get( AssetDataRegistry::class );
			return new BlockTypesController( $asset_api, $asset_data_registry );
		}
	);
	$this->container->register(
		BlockTemplatesRegistry::class,
		function ( Container $container ) {
			return new BlockTemplatesRegistry();
		}
	);
	$this->container->register(
		BlockTemplatesController::class,
		function ( Container $container ) {
			return new BlockTemplatesController();
		}
	);
	$this->container->register(
		ClassicTemplatesCompatibility::class,
		function ( Container $container ) {
			$asset_data_registry = $container->get( AssetDataRegistry::class );
			return new ClassicTemplatesCompatibility( $asset_data_registry );
		}
	);
	$this->container->register(
		ArchiveProductTemplatesCompatibility::class,
		function () {
			return new ArchiveProductTemplatesCompatibility();
		}
	);
	$this->container->register(
		SingleProductTemplateCompatibility::class,
		function () {
			return new SingleProductTemplateCompatibility();
		}
	);
	$this->container->register(
		DraftOrders::class,
		function( Container $container ) {
			return new DraftOrders( $container->get( Package::class ) );
		}
	);
	$this->container->register(
		CreateAccount::class,
		function( Container $container ) {
			return new CreateAccount( $container->get( Package::class ) );
		}
	);
	$this->container->register(
		GoogleAnalytics::class,
		function( Container $container ) {
			$asset_api = $container->get( AssetApi::class );
			return new GoogleAnalytics( $asset_api );
		}
	);
	$this->container->register(
		Notices::class,
		function( Container $container ) {
			return new Notices( $container->get( Package::class ) );
		}
	);
	$this->container->register(
		Hydration::class,
		function( Container $container ) {
			return new Hydration( $container->get( AssetDataRegistry::class ) );
		}
	);
	$this->container->register(
		CheckoutFields::class,
		function( Container $container ) {
			return new CheckoutFields( $container->get( AssetDataRegistry::class ) );
		}
	);
	$this->container->register(
		CheckoutFieldsAdmin::class,
		function( Container $container ) {
			$checkout_fields_controller = $container->get( CheckoutFields::class );
			return new CheckoutFieldsAdmin( $checkout_fields_controller );
		}
	);
	$this->container->register(
		CheckoutFieldsFrontend::class,
		function( Container $container ) {
			$checkout_fields_controller = $container->get( CheckoutFields::class );
			return new CheckoutFieldsFrontend( $checkout_fields_controller );
		}
	);
	$this->container->register(
		PaymentsApi::class,
		function ( Container $container ) {
			$payment_method_registry = $container->get( PaymentMethodRegistry::class );
			$asset_data_registry     = $container->get( AssetDataRegistry::class );
			return new PaymentsApi( $payment_method_registry, $asset_data_registry );
		}
	);
	$this->container->register(
		StoreApi::class,
		function () {
			return new StoreApi();
		}
	);
	// Maintains backwards compatibility with previous Store API namespace.
	$this->container->register(
		'Automattic\WooCommerce\Blocks\StoreApi\Formatters',
		function( Container $container ) {
			$this->deprecated_dependency( 'Automattic\WooCommerce\Blocks\StoreApi\Formatters', '6.4.0', 'Automattic\WooCommerce\StoreApi\Formatters', '6.5.0' );
			return $container->get( StoreApi::class )->container()->get( \Automattic\WooCommerce\StoreApi\Formatters::class );
		}
	);
	$this->container->register(
		'Automattic\WooCommerce\Blocks\Domain\Services\ExtendRestApi',
		function( Container $container ) {
			$this->deprecated_dependency( 'Automattic\WooCommerce\Blocks\Domain\Services\ExtendRestApi', '6.4.0', 'Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema', '6.5.0' );
			return $container->get( StoreApi::class )->container()->get( \Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema::class );
		}
	);
	$this->container->register(
		'Automattic\WooCommerce\Blocks\StoreApi\SchemaController',
		function( Container $container ) {
			$this->deprecated_dependency( 'Automattic\WooCommerce\Blocks\StoreApi\SchemaController', '6.4.0', 'Automattic\WooCommerce\StoreApi\SchemaController', '6.5.0' );
			return $container->get( StoreApi::class )->container()->get( SchemaController::class );
		}
	);
	$this->container->register(
		'Automattic\WooCommerce\Blocks\StoreApi\RoutesController',
		function( Container $container ) {
			$this->deprecated_dependency( 'Automattic\WooCommerce\Blocks\StoreApi\RoutesController', '6.4.0', 'Automattic\WooCommerce\StoreApi\RoutesController', '6.5.0' );
			return $container->get( StoreApi::class )->container()->get( RoutesController::class );
		}
	);
	$this->container->register(
		BlockPatterns::class,
		function () {
			return new BlockPatterns( $this->package );
		}
	);
	$this->container->register(
		ShippingController::class,
		function ( $container ) {
			$asset_api           = $container->get( AssetApi::class );
			$asset_data_registry = $container->get( AssetDataRegistry::class );
			return new ShippingController( $asset_api, $asset_data_registry );
		}
	);
	$this->container->register(
		TasksController::class,
		function() {
			return new TasksController();
		}
	);
	$this->container->register(
		QueryFilters::class,
		function() {
			return new QueryFilters();
		}
	);
}