class ServiceManager implements ManagerInterface (View source)

Properties

protected Application $app
protected array $extensions
protected ServiceInterface[] $services

Methods

__construct(Application $app)

Manager constructor.

extend(string $handle, string|callable|ServiceInterface $abstract)

Add an extension to this manager.

string[]
getExtensions()

An array of handles that have been added with ->extend.

bool
has($handle)

Does this handle exist? This method MUST return true for anything added with ->extend.

getService($handle, string $version = '')

Get the driver for this handle.

buildService(string|callable $abstract, string $version = '')

Build a service from an abstract.

getAllServices()

Returns all the available services.

getActiveServices()

Loops through the bound services and returns the ones that are active.

Details

__construct(Application $app)

Manager constructor.

Parameters

Application $app

extend(string $handle, string|callable|ServiceInterface $abstract)

Add an extension to this manager.

Parameters

string $handle
string|callable|ServiceInterface $abstract

string[] getExtensions()

An array of handles that have been added with ->extend.

Return Value

string[]

bool has($handle)

Does this handle exist? This method MUST return true for anything added with ->extend.

Parameters

$handle

Return Value

bool

ServiceInterface|null getService($handle, string $version = '')

Get the driver for this handle.

Parameters

$handle
string $version

Return Value

ServiceInterface|null

private ServiceInterface|null buildService(string|callable $abstract, string $version = '')

Build a service from an abstract.

Parameters

string|callable $abstract
string $version

Return Value

ServiceInterface|null

ServiceInterface[] getAllServices()

Returns all the available services.

Return Value

ServiceInterface[]

ServiceInterface[] getActiveServices()

Loops through the bound services and returns the ones that are active.

Return Value

ServiceInterface[]