AbstractResolver
in package

AbstractYes

Abstract Resolver

Base class for service resolvers. Handles the callback storage and resolution logic.

Tags
since
4.0.0

Table of Contents

Properties

$singleton  : bool
Whether this resolver should return a singleton instance.
$callback  : mixed
The callback or value to resolve.

Methods

__construct()  : mixed
Constructor.
get()  : mixed
Get the resolved value.
resolve()  : mixed
Resolve the callback to a value.

Properties

Methods

__construct()

Constructor.

public __construct(mixed $value, bool $singleton) : mixed
Parameters
$value : mixed

Either a closure or the value itself.

$singleton : bool

Whether to cache the resolved value.

resolve()

Resolve the callback to a value.

protected resolve(Container $container) : mixed

If the callback is callable, it will be invoked with the container as an argument. Otherwise, the callback itself is returned.

If the resolved value is an object with an initialize() method, it will be called automatically. This allows services to set up hooks and filters upon instantiation.

Parameters
$container : Container

The container instance.

Return values
mixed

The resolved value.


        
On this page

Search results