class Pipeline extends Pipeline

internal  
 

Map failures at the closest gRPC middleware boundary.

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable
protected Container|null $container

The container implementation.

from  Pipeline
protected mixed $passable

The object being passed through the pipeline.

from  Pipeline
protected array $pipes

The array of class pipes.

from  Pipeline
protected string $method

The method to call on each pipe.

from  Pipeline
protected Closure|null $finally

The final callback to be executed after the pipeline ends regardless of the outcome.

from  Pipeline
protected string|UnitEnum|false|null $withinTransaction

Indicates whether to wrap the pipeline in a database transaction.

from  Pipeline

Methods

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

static void
macro(string $name, callable|object $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

__construct(Container|null $container = null)

Create a new class instance.

from  Pipeline
send(mixed $passable)

Set the object being sent through the pipeline.

from  Pipeline
through(mixed $pipes)

Set the array of pipes.

from  Pipeline
pipe(mixed $pipes)

Push additional pipes onto the pipeline.

from  Pipeline
via(string $method)

Set the method to call on the pipes.

from  Pipeline
mixed
then(Closure $destination)

Run the pipeline with a final destination callback.

from  Pipeline
toClosure(Closure $destination)

Create a reusable closure that receives a value on each invocation.

from  Pipeline
mixed
thenReturn()

Run the pipeline and return the result.

from  Pipeline
finally(Closure $callback)

Set a final callback to be executed after the pipeline ends regardless of the outcome.

from  Pipeline
prepareDestination(Closure $destination)

Get the final piece of the Closure onion.

from  Pipeline
carry()

Get a Closure that represents a slice of the application onion.

from  Pipeline
array
parsePipeString(string $pipe)

Parse full pipe string to get name and parameters.

from  Pipeline
array
pipes()

Get the array of configured pipes.

from  Pipeline
withinTransaction(string|UnitEnum|false|null $withinTransaction = null)

Execute each pipeline step within a database transaction.

from  Pipeline
getContainer()

Get the container instance.

from  Pipeline
setContainer(Container $container)

Set the container instance.

from  Pipeline
mixed
handleCarry(mixed $carry)

Handle the value returned from each pipe before passing it to the next.

from  Pipeline
mixed
handleException(mixed $passable, Throwable $e)

Map the given exception to an RPC failure value.

static void
flushState()

Flush all static state.

from  Pipeline

Details

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Macroable at line 28
static void macro(string $name, callable|object $macro)

Register a custom macro.

Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.

Parameters

string $name
callable|object $macro

Return Value

void

in Macroable at line 41
static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 57
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 68
static void flushMacros()

Flush the existing macros.

Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.

Return Value

void

in Macroable at line 78
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line 103
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Pipeline at line 55
__construct(Container|null $container = null)

Create a new class instance.

Parameters

Container|null $container

in Pipeline at line 63
Pipeline send(mixed $passable)

Set the object being sent through the pipeline.

Parameters

mixed $passable

Return Value

Pipeline

in Pipeline at line 73
Pipeline through(mixed $pipes)

Set the array of pipes.

Parameters

mixed $pipes

Return Value

Pipeline

in Pipeline at line 83
Pipeline pipe(mixed $pipes)

Push additional pipes onto the pipeline.

Parameters

mixed $pipes

Return Value

Pipeline

in Pipeline at line 93
Pipeline via(string $method)

Set the method to call on the pipes.

Parameters

string $method

Return Value

Pipeline

in Pipeline at line 103
mixed then(Closure $destination)

Run the pipeline with a final destination callback.

Parameters

Closure $destination

Return Value

mixed

in Pipeline at line 116
Closure toClosure(Closure $destination)

Create a reusable closure that receives a value on each invocation.

Class middleware resolves inside each call using its container lifetime. Supplied middleware objects and captured closure state remain shared. Transaction and finally callbacks are applied per invocation. Keep this pipeline's configuration unchanged while using the closure.

Parameters

Closure $destination

Return Value

Closure

in Pipeline at line 140
mixed thenReturn()

Run the pipeline and return the result.

Return Value

mixed

in Pipeline at line 150
Pipeline finally(Closure $callback)

Set a final callback to be executed after the pipeline ends regardless of the outcome.

Parameters

Closure $callback

Return Value

Pipeline

in Pipeline at line 160
protected Closure prepareDestination(Closure $destination)

Get the final piece of the Closure onion.

Parameters

Closure $destination

Return Value

Closure

in Pipeline at line 174
protected Closure carry()

Get a Closure that represents a slice of the application onion.

Return Value

Closure

in Pipeline at line 229
protected array parsePipeString(string $pipe)

Parse full pipe string to get name and parameters.

Parameters

string $pipe

Return Value

array

in Pipeline at line 245
protected array pipes()

Get the array of configured pipes.

Return Value

array

in Pipeline at line 253
Pipeline withinTransaction(string|UnitEnum|false|null $withinTransaction = null)

Execute each pipeline step within a database transaction.

Parameters

string|UnitEnum|false|null $withinTransaction

Return Value

Pipeline

in Pipeline at line 263
protected Container getContainer()

Get the container instance.

Return Value

Container

in Pipeline at line 275
Pipeline setContainer(Container $container)

Set the container instance.

Parameters

Container $container

Return Value

Pipeline

in Pipeline at line 285
protected mixed handleCarry(mixed $carry)

Handle the value returned from each pipe before passing it to the next.

Parameters

mixed $carry

Return Value

mixed

at line 20
protected mixed handleException(mixed $passable, Throwable $e)

Map the given exception to an RPC failure value.

Parameters

mixed $passable
Throwable $e

Return Value

mixed

in Pipeline at line 303
static void flushState()

Flush all static state.

Return Value

void