class PendingBatchFake extends PendingBatch (View source)

Traits

Properties

protected Container $container

The IoC container instance.

from  PendingBatch
string $name

The batch name.

from  PendingBatch
Collection $jobs

The jobs that belong to the batch.

from  PendingBatch
array $options

The batch options.

from  PendingBatch
protected BusFake $bus

The fake bus instance.

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(BusFake $bus, Collection $jobs)

Create a new pending batch instance.

$this
add(iterable|object|array $jobs)

Add jobs to the batch.

$this
before(callable $callback)

Add a callback to be executed when the batch is stored.

array
beforeCallbacks()

Get the "before" callbacks that have been registered with the pending batch.

$this
progress(callable $callback)

Add a callback to be executed after a job in the batch have executed successfully.

array
progressCallbacks()

Get the "progress" callbacks that have been registered with the pending batch.

$this
then(callable $callback)

Add a callback to be executed after all jobs in the batch have executed successfully.

array
thenCallbacks()

Get the "then" callbacks that have been registered with the pending batch.

$this
catch(callable $callback)

Add a callback to be executed after the first failing job in the batch.

array
catchCallbacks()

Get the "catch" callbacks that have been registered with the pending batch.

$this
finally(callable $callback)

Add a callback to be executed after the batch has finished executing.

array
finallyCallbacks()

Get the "finally" callbacks that have been registered with the pending batch.

$this
allowFailures(bool $allowFailures = true)

Indicate that the batch should not be cancelled when a job within the batch fails.

bool
allowsFailures()

Determine if the pending batch allows jobs to fail without cancelling the batch.

$this
name(string $name)

Set the name for the batch.

$this
onConnection(string $connection)

Specify the queue connection that the batched jobs should run on.

string|null
connection()

Get the connection used by the pending batch.

$this
onQueue(string $queue)

Specify the queue that the batched jobs should run on.

string|null
queue()

Get the queue used by the pending batch.

$this
withOption(string $key, mixed $value)

Add additional data into the batch's options array.

dispatch()

Dispatch the batch.

dispatchAfterResponse()

Dispatch the batch after the response is sent to the browser.

void
dispatchExistingBatch(Batch $batch)

Dispatch an existing batch.

Batch|null
dispatchIf(bool|Closure $boolean)

Dispatch the batch if the given truth test passes.

Batch|null
dispatchUnless(bool|Closure $boolean)

Dispatch the batch unless the given truth test passes.

store(BatchRepository $repository)

Store the batch using the given repository.

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(BusFake $bus, Collection $jobs)

Create a new pending batch instance.

Parameters

BusFake $bus
Collection $jobs

Return Value

void

$this add(iterable|object|array $jobs)

Add jobs to the batch.

Parameters

iterable|object|array $jobs

Return Value

$this

$this before(callable $callback)

Add a callback to be executed when the batch is stored.

Parameters

callable $callback

Return Value

$this

array beforeCallbacks()

Get the "before" callbacks that have been registered with the pending batch.

Return Value

array

$this progress(callable $callback)

Add a callback to be executed after a job in the batch have executed successfully.

Parameters

callable $callback

Return Value

$this

array progressCallbacks()

Get the "progress" callbacks that have been registered with the pending batch.

Return Value

array

$this then(callable $callback)

Add a callback to be executed after all jobs in the batch have executed successfully.

Parameters

callable $callback

Return Value

$this

array thenCallbacks()

Get the "then" callbacks that have been registered with the pending batch.

Return Value

array

$this catch(callable $callback)

Add a callback to be executed after the first failing job in the batch.

Parameters

callable $callback

Return Value

$this

array catchCallbacks()

Get the "catch" callbacks that have been registered with the pending batch.

Return Value

array

$this finally(callable $callback)

Add a callback to be executed after the batch has finished executing.

Parameters

callable $callback

Return Value

$this

array finallyCallbacks()

Get the "finally" callbacks that have been registered with the pending batch.

Return Value

array

$this allowFailures(bool $allowFailures = true)

Indicate that the batch should not be cancelled when a job within the batch fails.

Parameters

bool $allowFailures

Return Value

$this

bool allowsFailures()

Determine if the pending batch allows jobs to fail without cancelling the batch.

Return Value

bool

$this name(string $name)

Set the name for the batch.

Parameters

string $name

Return Value

$this

$this onConnection(string $connection)

Specify the queue connection that the batched jobs should run on.

Parameters

string $connection

Return Value

$this

string|null connection()

Get the connection used by the pending batch.

Return Value

string|null

$this onQueue(string $queue)

Specify the queue that the batched jobs should run on.

Parameters

string $queue

Return Value

$this

string|null queue()

Get the queue used by the pending batch.

Return Value

string|null

$this withOption(string $key, mixed $value)

Add additional data into the batch's options array.

Parameters

string $key
mixed $value

Return Value

$this

Batch dispatch()

Dispatch the batch.

Return Value

Batch

Batch dispatchAfterResponse()

Dispatch the batch after the response is sent to the browser.

Return Value

Batch

protected void dispatchExistingBatch(Batch $batch)

Dispatch an existing batch.

Parameters

Batch $batch

Return Value

void

Exceptions

Throwable

Batch|null dispatchIf(bool|Closure $boolean)

Dispatch the batch if the given truth test passes.

Parameters

bool|Closure $boolean

Return Value

Batch|null

Batch|null dispatchUnless(bool|Closure $boolean)

Dispatch the batch unless the given truth test passes.

Parameters

bool|Closure $boolean

Return Value

Batch|null

protected Batch store(BatchRepository $repository)

Store the batch using the given repository.

Parameters

BatchRepository $repository

Return Value

Batch