WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Vendor\League\Container\ServiceProvider

ServiceProviderAggregate::add() public WC 1.0

{@inheritdoc}

{} It's a method of the class: ServiceProviderAggregate{}

No Hooks.

Return

null. Nothing.

Usage

$ServiceProviderAggregate = new ServiceProviderAggregate();
$ServiceProviderAggregate->add( $provider ) : ServiceProviderAggregateInterface;
$provider (required)
-

Code of ServiceProviderAggregate::add() WC 5.8.0

public function add($provider) : ServiceProviderAggregateInterface
{
    if (is_string($provider) && $this->getContainer()->has($provider)) {
        $provider = $this->getContainer()->get($provider);
    } elseif (is_string($provider) && class_exists($provider)) {
        $provider = new $provider;
    }

    if (in_array($provider, $this->providers, true)) {
        return $this;
    }

    if ($provider instanceof ContainerAwareInterface) {
        $provider->setLeagueContainer($this->getLeagueContainer());
    }

    if ($provider instanceof BootableServiceProviderInterface) {
        $provider->boot();
    }

    if ($provider instanceof ServiceProviderInterface) {
        $this->providers[] = $provider;

        return $this;
    }

    throw new ContainerException(
        'A service provider must be a fully qualified class name or instance ' .
        'of (\Automattic\WooCommerce\Vendor\League\Container\ServiceProvider\ServiceProviderInterface)'
    );
}