Package::container() – Loads the dependency injection container for woocommerce blocks.

You appear to be a bot. Output may be restricted

Description

Loads the dependency injection container for woocommerce blocks.

Usage

Package::container( $reset );

Parameters

$reset
( boolean ) optional – Used to reset the container to a fresh instance. Note: this means all dependencies will be reconstructed.

Returns

void

Source

File name: woocommerce/packages/woocommerce-blocks/src/Package.php
Lines:

1 to 32 of 32
  public static function container( $reset = false ) {
    static $container;
    if (
        ! $container instanceof Container
        || $reset
      ) {
      $container = new Container();
      // register Package.
      $container->register(
        NewPackage::class,
        function ( $container ) {
          // leave for automated version bumping.
          $version = '5.3.2';
          return new NewPackage(
            $version,
            dirname( __DIR__ ),
            new FeatureGating()
          );
        }
      );
      // register Bootstrap.
      $container->register(
        Bootstrap::class,
        function ( $container ) {
          return new Bootstrap(
            $container
          );
        }
      );
    }
    return $container;
  }
 

 View on GitHub View on Trac