WooCommerce Code Reference

Container
in package
implements ContainerInterface

Interfaces, Classes and Traits

ContainerInterface
Describes the interface of a container that exposes methods to read its entries.

Table of Contents

$defaultToShared  : bool
$definitions  : DefinitionAggregateInterface
$delegates  : array<string|int, ContainerInterface>
$inflectors  : InflectorAggregateInterface
$providers  : ServiceProviderAggregateInterface
__construct()  : mixed
Construct.
add()  : DefinitionInterface
Add an item to the container.
addServiceProvider()  : self
Add a service provider.
defaultToShared()  : self
Whether the container should default to defining shared definitions.
delegate()  : self
Delegate a backup container to be checked for services if it cannot be resolved via this container.
extend()  : DefinitionInterface
Get a definition to extend.
get()  : mixed
Finds an entry of the container by its identifier and returns it.
has()  : bool
Returns true if the container can return an entry for the given identifier.
inflector()  : InflectorInterface
Allows for manipulation of specific types on resolution.
share()  : DefinitionInterface
Proxy to add with shared as true.

Properties

Methods

defaultToShared()

Whether the container should default to defining shared definitions.

public defaultToShared([bool $shared = true ]) : self
Parameters
$shared : bool = true
Return values
self

get()

Finds an entry of the container by its identifier and returns it.

public get(mixed $id[, bool $new = false ]) : mixed
Parameters
$id : mixed

Identifier of the entry to look for.

$new : bool = false
Return values
mixedEntry.

has()

Returns true if the container can return an entry for the given identifier.

public has(mixed $id) : bool
Parameters
$id : mixed

Identifier of the entry to look for.

Return values
bool