class CallableEntry implements EntryInterface (View source)

Container entry that uses a callable to determine the value for the entry.

Methods

__construct(callable $callable)

CallableEntry constructor.

static EntryInterface
createFromCacheParameters(array $parameters)

Initializes the entry from the given container cache parameters.

array
getCacheParameters()

Returns the container cache parameters for the entry.

bool
isFactory()

Tells if we should not cache the value because the entry is a factory.

mixed
getValue(ContainerInterface $container)

Returns the value for the container entry.

Details

__construct(callable $callable)

CallableEntry constructor.

Parameters

callable $callable The callable used to determine the value for the entry

static EntryInterface createFromCacheParameters(array $parameters)

Initializes the entry from the given container cache parameters.

Parameters

array $parameters The container cache parameters for the entry

Return Value

EntryInterface The initialized container entry

array getCacheParameters()

Returns the container cache parameters for the entry.

Return Value

array The container cache parameters for the entry

Exceptions

ContainerException If the entry cannot be cached

bool isFactory()

Tells if we should not cache the value because the entry is a factory.

Return Value

bool True if the entry is factory and the value should not be cached, false otherwise

mixed getValue(ContainerInterface $container)

Returns the value for the container entry.

Parameters

ContainerInterface $container Container used to resolve dependencies

Return Value

mixed The value for the container entry

Exceptions

NotFoundExceptionInterface If trying to use dependencies that do not exist
ContainerExceptionInterface If there are errors trying to load dependencies