Inpsyde\MultilingualPress\Service\Container::share PHP Method

share() public method

Stores the given value or factory callback with the given name, and defines it to be accessible even after the container has been bootstrapped.
Since: 3.0.0
public share ( string $name, mixed $value ) : static
$name string The name of a value or factory callback.
$value mixed The value or factory callback.
return static Container instance.
    public function share($name, $value);

Usage Example

 /**
  * Registers the provided services on the given container.
  *
  * @since 3.0.0
  *
  * @param Container $container Container object.
  *
  * @return void
  */
 public function register(Container $container)
 {
     $container->share('multilingualpress.asset_factory', function (Container $container) {
         return new AssetFactory($container['multilingualpress.internal_locations']);
     });
     $container->share('multilingualpress.asset_manager', function () {
         return new AssetManager();
     });
 }
All Usage Examples Of Inpsyde\MultilingualPress\Service\Container::share