class ContextualBindingBuilder implements ContextualBindingBuilder (View source)

Properties

protected Container $container

The underlying container instance.

protected string|array $concrete

The concrete instance.

protected string $needs

The abstract target.

Methods

void
__construct(Container $container, string|array $concrete)

Create a new contextual binding builder.

$this
needs(string $abstract)

Define the abstract target that depends on the context.

void
give(Closure|string|array $implementation)

Define the implementation for the contextual binding.

void
giveTagged(string $tag)

Define tagged services to be used as the implementation for the contextual binding.

void
giveConfig(string $key, ?string $default = null)

Specify the configuration item to bind as a primitive.

Details

void __construct(Container $container, string|array $concrete)

Create a new contextual binding builder.

Parameters

Container $container
string|array $concrete

Return Value

void

$this needs(string $abstract)

Define the abstract target that depends on the context.

Parameters

string $abstract

Return Value

$this

void give(Closure|string|array $implementation)

Define the implementation for the contextual binding.

Parameters

Closure|string|array $implementation

Return Value

void

void giveTagged(string $tag)

Define tagged services to be used as the implementation for the contextual binding.

Parameters

string $tag

Return Value

void

void giveConfig(string $key, ?string $default = null)

Specify the configuration item to bind as a primitive.

Parameters

string $key
?string $default

Return Value

void