Container
class Container
The dependency injection container default implementation.
Properties
array deprecated | $parameters | ||
protected string[] | $aliases | ||
protected array[] | $tags | ||
protected array[] | $wiring |
Methods
No description
No description
No description
No description
No description
Adds the service or its factory to the container.
Removes a service instance from the container.
Returns the service instance. If it has not been created yet, it creates it.
Returns the service instance. If it has not been created yet, it creates it.
Returns type of the service.
Does the service exist?
Has a service instance been created?
Creates new instance of the service.
Returns an instance of the autowired service of the given type. If it has not been created yet, it creates it.
Returns the names of autowired services of the given type.
Returns the names of all services of the given type.
Returns the names of services with the given tag.
Creates an instance of the class and passes dependencies to the constructor using autowiring.
Calls all methods starting with 'inject' and passes dependencies to them via autowiring.
Calls the method and passes dependencies to it via autowiring.
Returns the method name for creating a service.
No description
Details
at line 49
__construct(array $params = [])
No description
at line 56
array
getParameters()
No description
at line 62
mixed
getParameter(string|int $key)
No description
at line 71
protected array
getStaticParameters()
No description
at line 77
protected mixed
getDynamicParameter(string|int $key)
No description
at line 87
Container
addService(string $name, object $service)
Adds the service or its factory to the container.
at line 126
void
removeService(string $name)
Removes a service instance from the container.
at line 137
object
getService(string $name)
Returns the service instance. If it has not been created yet, it creates it.
at line 156
object
getByName(string $name)
Returns the service instance. If it has not been created yet, it creates it.
Alias for getService().
at line 166
string
getServiceType(string $name)
Returns type of the service.
at line 187
bool
hasService(string $name)
Does the service exist?
at line 197
bool
isCreated(string $name)
Has a service instance been created?
at line 212
object
createService(string $name)
Creates new instance of the service.
at line 242
object|null
getByType(string $type, bool $throw = true)
Returns an instance of the autowired service of the given type. If it has not been created yet, it creates it.
at line 272
array
findAutowired(string $type)
internal |
Returns the names of autowired services of the given type.
at line 283
array
findByType(string $type)
Returns the names of all services of the given type.
at line 296
array
findByTag(string $tag)
Returns the names of services with the given tag.
at line 328
object
createInstance(string $class, array $args = [])
Creates an instance of the class and passes dependencies to the constructor using autowiring.
at line 348
void
callInjects(object $service)
Calls all methods starting with 'inject' and passes dependencies to them via autowiring.
at line 357
mixed
callMethod(callable $function, array $args = [])
Calls the method and passes dependencies to it via autowiring.
at line 374
final static string
getMethodName(string $name)
Returns the method name for creating a service.
at line 384
void
initialize()
No description