class Hub implements Hub

Properties

protected Container|null $container

The container implementation.

protected array $pipelines

All of the available pipelines.

Methods

__construct(Container|null $container = null)

Create a new Hub instance.

void
defaults(Closure $callback)

Define the default named pipeline.

void
pipeline(string $name, Closure $callback)

Define a new named pipeline.

mixed
pipe(mixed $object, string|null $pipeline = null)

Send an object through one of the available pipelines.

Container|null
getContainer()

Get the container instance used by the hub.

Hub
setContainer(Container $container)

Set the container instance used by the hub.

Details

at line 27
__construct(Container|null $container = null)

Create a new Hub instance.

Parameters

Container|null $container

at line 40
void defaults(Closure $callback)

Define the default named pipeline.

Boot-only. The callback persists on the singleton Hub for the worker lifetime and is executed on every subsequent Hub::pipe() call that does not specify a pipeline name. Per-request registration races across coroutines.

Parameters

Closure $callback

Return Value

void

at line 52
void pipeline(string $name, Closure $callback)

Define a new named pipeline.

Boot-only. The callback persists on the singleton Hub for the worker lifetime and is executed on every subsequent Hub::pipe() call for this name. Per-request registration races across coroutines.

Parameters

string $name
Closure $callback

Return Value

void

at line 60
mixed pipe(mixed $object, string|null $pipeline = null)

Send an object through one of the available pipelines.

Parameters

mixed $object
string|null $pipeline

Return Value

mixed

at line 78
Container|null getContainer()

Get the container instance used by the hub.

Return Value

Container|null

at line 90
Hub setContainer(Container $container)

Set the container instance used by the hub.

Tests only. Swaps the container on the singleton Hub used by every coroutine; per-request use races across coroutines and breaks every concurrent pipeline dispatch.

Parameters

Container $container

Return Value

Hub