Automattic\WooCommerce\Vendor\League\Container\Definition

DefinitionAggregate::add()publicWC 1.0

{@inheritdoc}

Method of the class: DefinitionAggregate{}

No Hooks.

Return

null. Nothing.

Usage

$DefinitionAggregate = new DefinitionAggregate();
$DefinitionAggregate->add( $id, $definition, $shared ) : DefinitionInterface;
$id(string) (required)
-
$definition (required)
-
$shared(true|false)
-
Default: false

DefinitionAggregate::add() code WC 7.1.0

public function add(string $id, $definition, bool $shared = false) : DefinitionInterface
{
    if (!$definition instanceof DefinitionInterface) {
        $definition = new Definition($id, $definition);
    }

    $this->definitions[] = $definition
        ->setAlias($id)
        ->setShared($shared)
    ;

    return $definition;
}