ContainerInterface
extends
DefinitionContainerInterface
in
Interface for the Dependency Injection Container in CakePHP applications
This interface extends the PSR-11 container interface and adds methods to add services and service providers to the container.
The methods defined in this interface use the conventions provided by league/container as that is the library that CakePHP uses.
Table of Contents
Methods
- add() : DefinitionInterface
- addServiceProvider() : self
- addShared() : DefinitionInterface
- extend() : DefinitionInterface
- get() : mixed
- Finds an entry of the container by its identifier and returns it.
- getNew() : mixed
- has() : bool
- Returns true if the container can return an entry for the given identifier.
- inflector() : InflectorInterface
Methods
add()
public
add(string $id[, mixed $concrete = null ]) : DefinitionInterface
Parameters
- $id : string
- $concrete : mixed = null
Return values
DefinitionInterfaceaddServiceProvider()
public
addServiceProvider(ServiceProviderInterface $provider) : self
Parameters
- $provider : ServiceProviderInterface
Return values
selfaddShared()
public
addShared(string $id[, mixed $concrete = null ]) : DefinitionInterface
Parameters
- $id : string
- $concrete : mixed = null
Return values
DefinitionInterfaceextend()
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(string $id) : mixed
Parameters
- $id : string
-
Identifier of the entry to look for.
Tags
Return values
mixed —Entry.
getNew()
public
getNew(mixed $id) : mixed
Parameters
- $id : mixed
has()
Returns true if the container can return an entry for the given identifier.
public
has(string $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 : string
-
Identifier of the entry to look for.
Return values
boolinflector()
public
inflector(string $type[, callable $callback = null ]) : InflectorInterface
Parameters
- $type : string
- $callback : callable = null