ContainerInterface
extends
ContainerInterface
in
ContainerInterface is the interface implemented by service container classes.
Tags
Table of Contents
- EXCEPTION_ON_INVALID_REFERENCE = 1
- IGNORE_ON_INVALID_REFERENCE = 3
- IGNORE_ON_UNINITIALIZED_REFERENCE = 4
- NULL_ON_INVALID_REFERENCE = 2
- RUNTIME_EXCEPTION_ON_INVALID_REFERENCE = 0
- get() : object|null
- Gets a service.
- getParameter() : mixed
- Gets a parameter.
- has() : bool
- Returns true if the given service is defined.
- hasParameter() : bool
- Checks if a parameter exists.
- initialized() : bool
- Check for whether or not a service has been initialized.
- set() : mixed
- Sets a service.
- setParameter() : mixed
- Sets a parameter.
Constants
EXCEPTION_ON_INVALID_REFERENCE
public
mixed
EXCEPTION_ON_INVALID_REFERENCE
= 1
IGNORE_ON_INVALID_REFERENCE
public
mixed
IGNORE_ON_INVALID_REFERENCE
= 3
IGNORE_ON_UNINITIALIZED_REFERENCE
public
mixed
IGNORE_ON_UNINITIALIZED_REFERENCE
= 4
NULL_ON_INVALID_REFERENCE
public
mixed
NULL_ON_INVALID_REFERENCE
= 2
RUNTIME_EXCEPTION_ON_INVALID_REFERENCE
public
mixed
RUNTIME_EXCEPTION_ON_INVALID_REFERENCE
= 0
Methods
get()
Gets a service.
public
get(string $id[, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE ]) : object|null
Parameters
- $id : string
-
The service identifier
- $invalidBehavior : int = self::EXCEPTION_ON_INVALID_REFERENCE
-
The behavior when the service does not exist
Tags
Return values
object|null —The associated service
getParameter()
Gets a parameter.
public
getParameter(string $name) : mixed
Parameters
- $name : string
-
The parameter name
Tags
Return values
mixed —The parameter value
has()
Returns true if the given service is defined.
public
has(string $id) : bool
Parameters
- $id : string
-
The service identifier
Return values
bool —true if the service is defined, false otherwise
hasParameter()
Checks if a parameter exists.
public
hasParameter(string $name) : bool
Parameters
- $name : string
-
The parameter name
Return values
bool —The presence of parameter in container
initialized()
Check for whether or not a service has been initialized.
public
initialized(string $id) : bool
Parameters
- $id : string
Return values
bool —true if the service has been initialized, false otherwise
set()
Sets a service.
public
set(string $id, object|null $service) : mixed
Parameters
- $id : string
- $service : object|null
Return values
mixed —setParameter()
Sets a parameter.
public
setParameter(string $name, mixed $value) : mixed
Parameters
- $name : string
-
The parameter name
- $value : mixed
-
The parameter value