class service_collection extends ArrayObject

Collection of services to be configured at container compile time.

Properties

protected ContainerInterface $container
protected array $service_classes

Methods

__construct(ContainerInterface $container)

Constructor

getIterator()

{@inheritdoc}

offsetGet($index)

{@inheritdoc}

void
add(string $name)

Add a service to the collection

add_service_class(string $service_id, string $class)

Add a service's class to the collection

array
get_service_classes()

Get services' classes

mixed
get_by_class($class)

Returns the service associated to a class

Details

at line 38
__construct(ContainerInterface $container)

Constructor

Parameters

ContainerInterface $container

Container object

at line 47
getIterator()

{@inheritdoc}

at line 55
offsetGet($index)

{@inheritdoc}

Parameters

$index

at line 66
void add(string $name)

Add a service to the collection

Parameters

string $name

The service name

Return Value

void

at line 77
add_service_class(string $service_id, string $class)

Add a service's class to the collection

Parameters

string $service_id
string $class

at line 87
array get_service_classes()

Get services' classes

Return Value

array

at line 98
mixed get_by_class($class)

Returns the service associated to a class

Parameters

$class

Return Value

mixed

Exceptions

RuntimeException

if the service isn't found