Methods |
public
|
__construct(array $params = [])
|
#
|
public
|
getParameters(): array
|
#
|
public
|
getParameter(string|int $key): mixed
|
#
|
protected
|
getStaticParameters(): array
|
#
|
protected
|
getDynamicParameter(string|int $key): mixed
|
#
|
public
|
addService(string $name, object $service): static
Adds the service or its factory to the container.
Adds the service or its factory to the container.
Parameters
$service |
service or its factory
|
|
#
|
public
|
removeService(string $name): void
Removes a service instance from the container.
Removes a service instance from the container.
|
#
|
public
|
getService(string $name): object
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.
Throws
|
#
|
public
|
getByName(string $name): object
Returns the service instance. If it has not been created yet, it creates it.
Alias for getService().
Returns the service instance. If it has not been created yet, it creates it.
Alias for getService().
Throws
|
#
|
public
|
getServiceType(string $name): string
Returns type of the service.
Returns type of the service.
Throws
|
#
|
public
|
hasService(string $name): bool
|
#
|
public
|
isCreated(string $name): bool
Has a service instance been created?
Has a service instance been created?
|
#
|
public
|
createService(string $name): object
Creates new instance of the service.
Creates new instance of the service.
Throws
|
#
|
public
|
getByType<T is object>(class-string<T> $type, bool $throw = true): ($throw is true ? T : ?T)
Returns an instance of the autowired service of the given type. If it has not been created yet, it creates it.
Returns an instance of the autowired service of the given type. If it has not been created yet, it creates it.
Throws
|
#
|
public
|
findByType(string $type): string[]
Returns the names of all services of the given type.
Returns the names of all services of the given type.
|
#
|
public
|
findByTag(string $tag): array
Returns the names of services with the given tag.
Returns the names of services with the given tag.
Returns
of [service name => tag attributes]
|
#
|
public
|
createInstance(string $class, array $args = []): object
Creates an instance of the class and passes dependencies to the constructor using autowiring.
Creates an instance of the class and passes dependencies to the constructor using autowiring.
|
#
|
public
|
callInjects(object $service): void
Calls all methods starting with 'inject' and passes dependencies to them via autowiring.
Calls all methods starting with 'inject' and passes dependencies to them via autowiring.
|
#
|
public
|
callMethod(callable $function, array $args = []): mixed
Calls the method and passes dependencies to it via autowiring.
Calls the method and passes dependencies to it via autowiring.
|
#
|
final
public
static
|
getMethodName(string $name): string
Returns the method name for creating a service.
Returns the method name for creating a service.
|
#
|
public
|
initialize(): void
|
#
|