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
$defaultToShared
protected
bool
$defaultToShared
= false
$definitions
protected
DefinitionAggregateInterface
$definitions
$delegates
protected
array<string|int, ContainerInterface>
$delegates
= []
$inflectors
protected
InflectorAggregateInterface
$inflectors
$providers
protected
ServiceProviderAggregateInterface
$providers
Methods
__construct()
Construct.
public
__construct([DefinitionAggregateInterface|null $definitions = null ][, ServiceProviderAggregateInterface|null $providers = null ][, InflectorAggregateInterface|null $inflectors = null ]) : mixed
Parameters
- $definitions : DefinitionAggregateInterface|null = null
- $providers : ServiceProviderAggregateInterface|null = null
- $inflectors : InflectorAggregateInterface|null = null
Return values
mixed —add()
Add an item to the container.
public
add(string $id[, mixed $concrete = null ][, bool $shared = null ]) : DefinitionInterface
Parameters
- $id : string
- $concrete : mixed = null
- $shared : bool = null
Return values
DefinitionInterface —addServiceProvider()
Add a service provider.
public
addServiceProvider(ServiceProviderInterface|string $provider) : self
Parameters
- $provider : ServiceProviderInterface|string
Return values
self —defaultToShared()
Whether the container should default to defining shared definitions.
public
defaultToShared([bool $shared = true ]) : self
Parameters
- $shared : bool = true
Return values
self —delegate()
Delegate a backup container to be checked for services if it cannot be resolved via this container.
public
delegate(ContainerInterface $container) : self
Parameters
- $container : ContainerInterface
Return values
self —extend()
Get a definition to extend.
public
extend(string $id) : DefinitionInterface
Parameters
- $id : string
-
[description]
Return values
DefinitionInterface —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
mixed — Entry.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 —inflector()
Allows for manipulation of specific types on resolution.
public
inflector(string $type[, callable|null $callback = null ]) : InflectorInterface
Parameters
- $type : string
- $callback : callable|null = null
Return values
InflectorInterface —share()
Proxy to add with shared as true.
public
share(string $id[, mixed $concrete = null ]) : DefinitionInterface
Parameters
- $id : string
- $concrete : mixed = null