Skip to main content
The JobInterface defines the contract for job objects that represent individual tasks within a workflow.

Namespace

Chevere\Workflow\Interfaces\JobInterface

Methods

parameters()

Provides access to the invocable ActionInterface|Closure parameters for this job.
public function parameters(): ParametersInterface
return
ParametersInterface
The parameters interface for this job’s action

return()

Provides access to the return type parameter for this job.
public function return(): ParameterInterface
return
ParameterInterface
The return parameter type for this job

action()

Provides access to the job’s action.
public function action(): ActionInterface|string|Closure
return
ActionInterface|class-string<ActionInterface>|Closure
The action instance, action class name, or closure to execute

arguments()

Provides access to the job’s arguments.
public function arguments(): array
return
array<string, mixed>
Associative array of argument names to values

dependencies()

Provides access to the job’s dependencies.
public function dependencies(): VectorInterface
return
VectorInterface<string>
Vector of job names that this job depends on

isSync()

Determines if the job is synchronous (blocking).
public function isSync(): bool
return
bool
True if the job is synchronous, false if async

runIf()

Provides access to the run-if conditions.
public function runIf(): VectorInterface
return
VectorInterface<ResponseReferenceInterface|VariableInterface|callable|bool>
Vector of conditions that must evaluate to true for the job to run

runIfNot()

Provides access to the run-if-not conditions.
public function runIfNot(): VectorInterface
return
VectorInterface<ResponseReferenceInterface|VariableInterface|callable|bool>
Vector of conditions that must evaluate to false for the job to run

caller()

Provides access to the caller who created this job.
public function caller(): CallerInterface
return
CallerInterface
The caller interface instance

retryPolicy()

Provides access to the job retry policy.
public function retryPolicy(): RetryPolicyInterface
return
RetryPolicyInterface
The retry policy for this job

withArguments()

Returns an instance with the specified arguments.
public function withArguments(mixed ...$argument): self
This method MUST retain the state of the current instance and return an instance that contains the specified arguments.
argument
mixed
required
One or more arguments to set for the job
return
self
New instance with the specified arguments

withRunIf()

Returns an instance with the specified run-if condition.
public function withRunIf(
    ResponseReferenceInterface|VariableInterface|callable|bool ...$context
): self
This method MUST retain the state of the current instance and return an instance that contains the specified run-if condition.
context
ResponseReferenceInterface|VariableInterface|callable|bool
required
One or more conditions that must evaluate to true for the job to run
return
self
New instance with the specified run-if condition

withRunIfNot()

Returns an instance with the specified run-if-not condition.
public function withRunIfNot(
    ResponseReferenceInterface|VariableInterface|callable|bool ...$context
): self
This method MUST retain the state of the current instance and return an instance that contains the specified run-if-not condition.
context
ResponseReferenceInterface|VariableInterface|callable|bool
required
One or more conditions that must evaluate to false for the job to run
return
self
New instance with the specified run-if-not condition

withIsSync()

Returns an instance with the specified sync flag.
public function withIsSync(bool $flag = true): self
This method MUST retain the state of the current instance and return an instance that contains the specified sync flag.
flag
bool
default:"true"
True for sync, false for async
return
self
New instance with the specified sync flag

withDepends()

Returns an instance with the specified job dependencies.
public function withDepends(string ...$jobs): self
This method MUST retain the state of the current instance and return an instance that contains the specified job dependencies.
jobs
string
required
One or more job names that this job depends on
return
self
New instance with the specified dependencies

withRetry()

Returns an instance with the specified retry policy.
public function withRetry(
    int $timeout = 0,
    int $maxAttempts = 1,
    int $delay = 0
): self
timeout
int<0, max>
default:"0"
Timeout in seconds across all attempts (0 = unlimited)
maxAttempts
int<1, max>
default:"1"
Number of attempts (minimum 1)
delay
int<0, max>
default:"0"
Retry delay in seconds (0 = no delay)
return
self
New instance with the specified retry policy

Implementation

See Job class for the concrete implementation.

Build docs developers (and LLMs) love