class Pipeline implements Pipeline (View source)

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|null|UnitEnum|false $withinTransaction

Indicates whether to wrap the pipeline in a database transaction.

Methods

$this|TWhenReturnType
when(TWhenParameter|TWhenParameter|null $value = null, callable|null $callback = null, callable|null $default = null)

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

$this|TUnlessReturnType
unless(TUnlessParameter|TUnlessParameter|null $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, object|callable $macro)

Register a custom macro.

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

Mix another object into the class.

static bool
hasMacro(string $name)

Checks 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.

$this
send(mixed $passable)

Set the object being sent through the pipeline.

$this
through(mixed $pipes)

Set the array of pipes.

$this
pipe(mixed $pipes)

Push additional pipes onto the pipeline.

$this
via(string $method)

Set the method to call on the pipes.

mixed
then(Closure $destination)

Run the pipeline with a final destination callback.

mixed
thenReturn()

Run the pipeline and return the result.

$this
finally(Closure $callback)

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

prepareDestination(Closure $destination)

Get the final piece of the Closure onion.

carry()

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

array
parsePipeString(string $pipe)

Parse full pipe string to get name and parameters.

array
pipes()

Get the array of configured pipes.

$this
withinTransaction(string|null|UnitEnum|false $withinTransaction = null)

Execute each pipeline step within a database transaction.

getContainer()

Get the container instance.

$this
setContainer(Container $container)

Set the container instance.

mixed
handleCarry(mixed $carry)

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

mixed
handleException(mixed $passable, Throwable $e)

Handle the given exception.

Details

$this|TWhenReturnType when(TWhenParameter|TWhenParameter|null $value = null, callable|null $callback = null, callable|null $default = null)

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

Parameters

TWhenParameter|TWhenParameter|null $value
callable|null $callback
callable|null $default

Return Value

$this|TWhenReturnType

$this|TUnlessReturnType unless(TUnlessParameter|TUnlessParameter|null $value = null, callable|null $callback = null, callable|null $default = null)

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

Parameters

TUnlessParameter|TUnlessParameter|null $value
callable|null $callback
callable|null $default

Return Value

$this|TUnlessReturnType

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

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

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

Mix another object into the class.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

static void flushMacros()

Flush the existing macros.

Return Value

void

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

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

__construct(Container|null $container = null)

Create a new class instance.

Parameters

Container|null $container

$this send(mixed $passable)

Set the object being sent through the pipeline.

Parameters

mixed $passable

Return Value

$this

$this through(mixed $pipes)

Set the array of pipes.

Parameters

mixed $pipes

Return Value

$this

$this pipe(mixed $pipes)

Push additional pipes onto the pipeline.

Parameters

mixed $pipes

Return Value

$this

$this via(string $method)

Set the method to call on the pipes.

Parameters

string $method

Return Value

$this

mixed then(Closure $destination)

Run the pipeline with a final destination callback.

Parameters

Closure $destination

Return Value

mixed

mixed thenReturn()

Run the pipeline and return the result.

Return Value

mixed

$this finally(Closure $callback)

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

Parameters

Closure $callback

Return Value

$this

protected Closure prepareDestination(Closure $destination)

Get the final piece of the Closure onion.

Parameters

Closure $destination

Return Value

Closure

protected Closure carry()

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

Return Value

Closure

protected array parsePipeString(string $pipe)

Parse full pipe string to get name and parameters.

Parameters

string $pipe

Return Value

array

protected array pipes()

Get the array of configured pipes.

Return Value

array

$this withinTransaction(string|null|UnitEnum|false $withinTransaction = null)

Execute each pipeline step within a database transaction.

Parameters

string|null|UnitEnum|false $withinTransaction

Return Value

$this

protected Container getContainer()

Get the container instance.

Return Value

Container

Exceptions

RuntimeException

$this setContainer(Container $container)

Set the container instance.

Parameters

Container $container

Return Value

$this

protected mixed handleCarry(mixed $carry)

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

Parameters

mixed $carry

Return Value

mixed

protected mixed handleException(mixed $passable, Throwable $e)

Handle the given exception.

Parameters

mixed $passable
Throwable $e

Return Value

mixed

Exceptions

Throwable

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.