class BatchFake extends Batch

Properties

array $added

The jobs that have been added to the batch.

bool $deleted

Indicates if the batch has been deleted.

Methods

__construct(string $id, string $name, int $totalJobs, int $pendingJobs, int $failedJobs, array $failedJobIds, array $options, CarbonImmutable $createdAt, CarbonImmutable|null $cancelledAt = null, CarbonImmutable|null $finishedAt = null)

Create a new batch instance.

Batch|null
fresh()

Get a fresh instance of the batch represented by this ID.

Batch|null
add(array|object $jobs)

Add additional jobs to the batch.

prepareBatchedChain(array $chain)

Prepare a chain that exists within the jobs being added.

from  Batch
int
processedJobs()

Get the total number of jobs that have been processed by the batch thus far.

from  Batch
int
progress()

Get the percentage of jobs that have been processed (between 0-100).

from  Batch
void
recordSuccessfulJob(string $jobId)

Record that a job within the batch finished successfully, executing any callbacks if necessary.

decrementPendingJobs(string $jobId)

Decrement the pending jobs for the batch.

void
invokeCallbacks(string $type, Throwable|null $e = null)

Invoke the callbacks of the given type.

from  Batch
bool
finished()

Determine if the batch has finished executing.

from  Batch
bool
hasProgressCallbacks()

Determine if the batch has "progress" callbacks.

from  Batch
bool
hasThenCallbacks()

Determine if the batch has "success" callbacks.

from  Batch
bool
allowsFailures()

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

from  Batch
bool
hasFailures()

Determine if the batch has job failures.

from  Batch
void
recordFailedJob(string $jobId, Throwable|null $e)

Record that a job within the batch failed to finish successfully, executing any callbacks if necessary.

incrementFailedJobs(string $jobId)

Increment the failed jobs for the batch.

bool
isFirstJobProcessed(UpdatedBatchJobCounts $counts)

Determine if this is the first job processed in the batch.

from  Batch
bool
hasCatchCallbacks()

Determine if the batch has "catch" callbacks.

from  Batch
bool
hasFailureCallbacks()

Determine if the batch has "failure" callbacks.

from  Batch
bool
hasFinallyCallbacks()

Determine if the batch has "finally" callbacks.

from  Batch
void
cancel(Throwable|null $exception = null)

Cancel the batch.

bool
canceled()

Determine if the batch has been cancelled.

from  Batch
bool
cancelled()

Determine if the batch has been cancelled.

from  Batch
void
delete()

Delete the batch from storage.

void
invokeHandlerCallback(callable $handler, Batch $batch, Throwable|null $e = null)

Invoke a batch callback handler.

from  Batch
array
toArray()

Convert the batch to an array.

from  Batch
array
jsonSerialize()

Get the JSON serializable representation of the object.

from  Batch
mixed
__get(string $key)

Dynamically access the batch's "options" via properties.

from  Batch
bool
deleted()

Determine if the batch has been deleted.

Details

at line 29
__construct(string $id, string $name, int $totalJobs, int $pendingJobs, int $failedJobs, array $failedJobIds, array $options, CarbonImmutable $createdAt, CarbonImmutable|null $cancelledAt = null, CarbonImmutable|null $finishedAt = null)

Create a new batch instance.

Parameters

string $id
string $name
int $totalJobs
int $pendingJobs
int $failedJobs
array $failedJobIds
array $options
CarbonImmutable $createdAt
CarbonImmutable|null $cancelledAt
CarbonImmutable|null $finishedAt

at line 46
Batch|null fresh()

Get a fresh instance of the batch represented by this ID.

Return Value

Batch|null

at line 56
Batch|null add(array|object $jobs)

Add additional jobs to the batch.

Parameters

array|object $jobs

Return Value

Batch|null

in Batch at line 104
protected Collection prepareBatchedChain(array $chain)

Prepare a chain that exists within the jobs being added.

Parameters

array $chain

Return Value

Collection

in Batch at line 116
int processedJobs()

Get the total number of jobs that have been processed by the batch thus far.

Return Value

int

in Batch at line 126
int progress()

Get the percentage of jobs that have been processed (between 0-100).

Return Value

int

at line 72
void recordSuccessfulJob(string $jobId)

Record that a job within the batch finished successfully, executing any callbacks if necessary.

Parameters

string $jobId

Return Value

void

at line 79
UpdatedBatchJobCounts|null decrementPendingJobs(string $jobId)

Decrement the pending jobs for the batch.

Parameters

string $jobId

Return Value

UpdatedBatchJobCounts|null

in Batch at line 192
protected void invokeCallbacks(string $type, Throwable|null $e = null)

Invoke the callbacks of the given type.

Parameters

string $type
Throwable|null $e

Return Value

void

in Batch at line 208
bool finished()

Determine if the batch has finished executing.

Return Value

bool

in Batch at line 216
bool hasProgressCallbacks()

Determine if the batch has "progress" callbacks.

Return Value

bool

in Batch at line 224
bool hasThenCallbacks()

Determine if the batch has "success" callbacks.

Return Value

bool

in Batch at line 232
bool allowsFailures()

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

Return Value

bool

in Batch at line 240
bool hasFailures()

Determine if the batch has job failures.

Return Value

bool

at line 87
void recordFailedJob(string $jobId, Throwable|null $e)

Record that a job within the batch failed to finish successfully, executing any callbacks if necessary.

Parameters

string $jobId
Throwable|null $e

Return Value

void

at line 94
UpdatedBatchJobCounts|null incrementFailedJobs(string $jobId)

Increment the failed jobs for the batch.

Parameters

string $jobId

Return Value

UpdatedBatchJobCounts|null

in Batch at line 302
protected bool isFirstJobProcessed(UpdatedBatchJobCounts $counts)

Determine if this is the first job processed in the batch.

Parameters

UpdatedBatchJobCounts $counts

Return Value

bool

in Batch at line 310
bool hasCatchCallbacks()

Determine if the batch has "catch" callbacks.

Return Value

bool

in Batch at line 318
bool hasFailureCallbacks()

Determine if the batch has "failure" callbacks.

Return Value

bool

in Batch at line 326
bool hasFinallyCallbacks()

Determine if the batch has "finally" callbacks.

Return Value

bool

at line 102
void cancel(Throwable|null $exception = null)

Cancel the batch.

Parameters

Throwable|null $exception

Return Value

void

in Batch at line 352
bool canceled()

Determine if the batch has been cancelled.

Return Value

bool

in Batch at line 360
bool cancelled()

Determine if the batch has been cancelled.

Return Value

bool

at line 110
void delete()

Delete the batch from storage.

Return Value

void

in Batch at line 376
protected void invokeHandlerCallback(callable $handler, Batch $batch, Throwable|null $e = null)

Invoke a batch callback handler.

Parameters

callable $handler
Batch $batch
Throwable|null $e

Return Value

void

in Batch at line 390
array toArray()

Convert the batch to an array.

Return Value

array

in Batch at line 410
array jsonSerialize()

Get the JSON serializable representation of the object.

Return Value

array

in Batch at line 418
mixed __get(string $key)

Dynamically access the batch's "options" via properties.

Parameters

string $key

Return Value

mixed

at line 118
bool deleted()

Determine if the batch has been deleted.

Return Value

bool