ContainerInterface
in
Describes the interface of a container that exposes methods to read its entries.
Table of Contents
Methods
- 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.
Methods
get()
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.
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.