class Service implements ServiceInterface

服务原型

容器中对单个服务单元的定义

Methods

__construct(string $id, object|string|array $definition, bool $shared = false)

Service constructor.

bool
isShared()

检查服务是否为共享的

mixed
resolve(array $parameters = null, ContainerInterface $container = null)

解析服务

Details

at line 52
__construct(string $id, object|string|array $definition, bool $shared = false)

Service constructor.

Parameters

string $id 服务标识
object|string|array $definition
bool $shared

at line 64
bool isShared()

检查服务是否为共享的

Return Value

bool

at line 77
mixed resolve(array $parameters = null, ContainerInterface $container = null)

解析服务

Parameters

array $parameters 参数
ContainerInterface $container 容器对象实例

Return Value

mixed

Exceptions

DomainException