Pipeline
class Pipeline implements Pipeline, Transient
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected Container|null | $container | The container implementation. |
|
| protected mixed | $passable | The object being passed through the pipeline. |
|
| protected array | $pipes | The array of class pipes. |
|
| protected string | $method | The method to call on each pipe. |
|
| protected Closure|null | $finally | The final callback to be executed after the pipeline ends regardless of the outcome. |
|
| protected string|UnitEnum|false|null | $withinTransaction | Indicates whether to wrap the pipeline in a database transaction. |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Run the pipeline and return the result.
Parse full pipe string to get name and parameters.
Get the array of configured pipes.
Execute each pipeline step within a database transaction.
Get the container instance.
Handle the value returned from each pipe before passing it to the next.
Flush all static state.
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.
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.
in
Macroable at line 30
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 44
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 61
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 72
static void
flushMacros()
Flush the existing macros.
Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 83
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 108
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 55
__construct(Container|null $container = null)
Create a new class instance.
at line 65
Pipeline
send(mixed $passable)
Set the object being sent through the pipeline.
at line 77
Pipeline
through(mixed $pipes)
Set the array of pipes.
at line 89
Pipeline
pipe(mixed $pipes)
Push additional pipes onto the pipeline.
at line 101
Pipeline
via(string $method)
Set the method to call on the pipes.
at line 111
mixed
then(Closure $destination)
Run the pipeline with a final destination callback.
at line 124
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.
at line 148
mixed
thenReturn()
Run the pipeline and return the result.
at line 160
Pipeline
finally(Closure $callback)
Set a final callback to be executed after the pipeline ends regardless of the outcome.
at line 170
protected Closure
prepareDestination(Closure $destination)
Get the final piece of the Closure onion.
at line 184
protected Closure
carry()
Get a Closure that represents a slice of the application onion.
at line 239
protected array
parsePipeString(string $pipe)
Parse full pipe string to get name and parameters.
at line 255
protected array
pipes()
Get the array of configured pipes.
at line 265
Pipeline
withinTransaction(string|UnitEnum|false|null $withinTransaction = null)
Execute each pipeline step within a database transaction.
at line 275
protected Container
getContainer()
Get the container instance.
at line 299
protected mixed
handleCarry(mixed $carry)
Handle the value returned from each pipe before passing it to the next.
at line 309
protected mixed
handleException(mixed $passable, Throwable $e)
Handle the given exception.
at line 317
static void
flushState()
Flush all static state.