class ClosureFactory (View source)

Factory that makes closures which resolve values from the container.

Methods

__construct(GenericFactory $factory)

Constructor.

value(string $key)

Make a closure that resolves a value from the container.

method(string $key, string $method)

Make a closure that resolves a class instance from the container and calls one of its methods.

Details

__construct(GenericFactory $factory)

Constructor.

Parameters

GenericFactory $factory

Closure value(string $key)

Make a closure that resolves a value from the container.

Parameters

string $key

Return Value

Closure

Closure method(string $key, string $method)

Make a closure that resolves a class instance from the container and calls one of its methods.

Useful if you need to pass a callable to an API without container support such as the REST API.

Parameters

string $key
string $method

Return Value

Closure