class Pipeline extends Pipeline (View source)

This extended pipeline catches any exceptions that occur during each slice.

The exceptions are converted to HTTP responses for proper middleware handling.

Traits

Properties

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

Methods

$this|TWhenReturnType
when($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($value = null, callable|null $callback = null, callable|null $default = null)

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

void
__construct(Container|null $container = null)

Create a new class instance.

from  Pipeline
$this
send(mixed $passable)

Set the object being sent through the pipeline.

from  Pipeline
$this
through(array|mixed $pipes)

Set the array of pipes.

from  Pipeline
$this
pipe(array|mixed $pipes)

Push additional pipes onto the pipeline.

from  Pipeline
$this
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
mixed
thenReturn()

Run the pipeline and return the result.

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
getContainer()

Get the container instance.

from  Pipeline
$this
setContainer(Container $container)

Set the container instance.

from  Pipeline
mixed
handleCarry(mixed $carry)

Handles 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($value = null, callable|null $callback = null, callable|null $default = null)

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

Parameters

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

Return Value

$this|TWhenReturnType

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

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

Parameters

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

Return Value

$this|TUnlessReturnType

void __construct(Container|null $container = null)

Create a new class instance.

Parameters

Container|null $container

Return Value

void

$this send(mixed $passable)

Set the object being sent through the pipeline.

Parameters

mixed $passable

Return Value

$this

$this through(array|mixed $pipes)

Set the array of pipes.

Parameters

array|mixed $pipes

Return Value

$this

$this pipe(array|mixed $pipes)

Push additional pipes onto the pipeline.

Parameters

array|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

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

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)

Handles 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