Container
in package
implements
ContainerInterface
FinalYes
A simple implementation of a container.
Tags
Table of Contents
Interfaces
- ContainerInterface
- Describes the interface of a container that exposes methods to read its entries.
Properties
- $definitions : array<string, callable|object|string>
- $services : array<string|int, mixed>
Methods
- __construct() : mixed
- Create a container object with a set of definitions. The array value MUST produce an object that implements Extension.
- get() : mixed
- Retrieve a definition from the container.
- has() : bool
- Check if the container contains a given identifier.
- getService() : mixed
- Get the service from a definition.
Properties
$definitions
private
array<string, callable|object|string>
$definitions
$services
private
array<string|int, mixed>
$services
= []
Methods
__construct()
Create a container object with a set of definitions. The array value MUST produce an object that implements Extension.
public
__construct(array<string, callable|object|string> $definitions) : mixed
Parameters
- $definitions : array<string, callable|object|string>
get()
Retrieve a definition from the container.
public
get(string $id) : mixed
Parameters
- $id : string
Tags
Return values
mixed —Entry.
has()
Check if the container contains a given identifier.
public
has(string $id) : bool
Parameters
- $id : string
Tags
Return values
boolgetService()
Get the service from a definition.
private
getService(string $id, callable|object|string $definition) : mixed
Parameters
- $id : string
- $definition : callable|object|string