ServiceContainer
in package
implements
ContainerInterface
Interfaces, Classes, Traits and Enums
- ContainerInterface
Table of Contents
- $bindings : array<string|int, mixed>
- The array of bindings in the container.
- $instances : array<string|int, mixed>
- The array of resolved instances.
- get() : mixed
- Retrieve a service or value from the container.
- has() : bool
- Check if a service or value exists in the container.
- reset() : void
- Reset all bindings and resolved instances in the container.
- set() : void
- Register a service or value in the container.
- unset() : void
- Remove a service from the container.
Properties
$bindings
The array of bindings in the container.
protected
array<string|int, mixed>
$bindings
= []
$instances
The array of resolved instances.
protected
array<string|int, mixed>
$instances
= []
Methods
get()
Retrieve a service or value from the container.
public
get(string $id) : mixed
Parameters
- $id : string
Tags
Return values
mixed —has()
Check if a service or value exists in the container.
public
has(string $id) : bool
Parameters
- $id : string
Return values
bool —reset()
Reset all bindings and resolved instances in the container.
public
reset() : void
Return values
void —set()
Register a service or value in the container.
public
set(string $id, callable|mixed $resolver) : void
Parameters
- $id : string
- $resolver : callable|mixed
Return values
void —unset()
Remove a service from the container.
public
unset(string $id) : void
Parameters
- $id : string