Container
in package
implements
DefinitionContainerInterface
Table of Contents
Interfaces
- DefinitionContainerInterface
- Describes the interface of a container that exposes methods to read its entries.
Properties
- $defaultToShared : bool
- $definitions : DefinitionAggregateInterface
- $delegates : array<string|int, ContainerInterface>
- $inflectors : InflectorAggregateInterface
- $providers : ServiceProviderAggregateInterface
Methods
- __construct() : mixed
- add() : DefinitionInterface
- addServiceProvider() : DefinitionContainerInterface
- addShared() : DefinitionInterface
- defaultToShared() : ContainerInterface
- delegate() : self
- extend() : DefinitionInterface
- get() : RequestedType|mixed
- Finds an entry of the container by its identifier and returns it.
- getNew() : RequestedType|mixed
- has() : bool
- Returns true if the container can return an entry for the given identifier.
- inflector() : InflectorInterface
- resolve() : mixed
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()
public
__construct([DefinitionAggregateInterface $definitions = null ][, ServiceProviderAggregateInterface $providers = null ][, InflectorAggregateInterface $inflectors = null ]) : mixed
Parameters
- $definitions : DefinitionAggregateInterface = null
- $providers : ServiceProviderAggregateInterface = null
- $inflectors : InflectorAggregateInterface = null
add()
public
add(string $id[, mixed $concrete = null ]) : DefinitionInterface
Parameters
- $id : string
- $concrete : mixed = null
Return values
DefinitionInterfaceaddServiceProvider()
public
addServiceProvider(ServiceProviderInterface $provider) : DefinitionContainerInterface
Parameters
- $provider : ServiceProviderInterface
Return values
DefinitionContainerInterfaceaddShared()
public
addShared(string $id[, mixed $concrete = null ]) : DefinitionInterface
Parameters
- $id : string
- $concrete : mixed = null
Return values
DefinitionInterfacedefaultToShared()
public
defaultToShared([bool $shared = true ]) : ContainerInterface
Parameters
- $shared : bool = true
Return values
ContainerInterfacedelegate()
public
delegate(ContainerInterface $container) : self
Parameters
- $container : ContainerInterface
Return values
selfextend()
public
extend(string $id) : DefinitionInterface
Parameters
- $id : string
Return values
DefinitionInterfaceget()
Finds an entry of the container by its identifier and returns it.
public
get(RequestedType>|string $id) : RequestedType|mixed
Parameters
- $id : RequestedType>|string
Tags
Return values
RequestedType|mixedgetNew()
public
getNew(RequestedType>|string $id) : RequestedType|mixed
Parameters
- $id : RequestedType>|string
Tags
Return values
RequestedType|mixedhas()
Returns true if the container can return an entry for the given identifier.
public
has(mixed $id) : bool
Returns false otherwise.
has($id)
returning true does not mean that get($id)
will not throw an exception.
It does however mean that get($id)
will not throw a NotFoundExceptionInterface
.
Parameters
- $id : mixed
-
Identifier of the entry to look for.
Return values
boolinflector()
public
inflector(string $type[, callable $callback = null ]) : InflectorInterface
Parameters
- $type : string
- $callback : callable = null
Return values
InflectorInterfaceresolve()
protected
resolve(mixed $id[, bool $new = false ]) : mixed
Parameters
- $id : mixed
- $new : bool = false