Skip to main content
The WorkflowInterface defines the contract for workflow objects that orchestrate collections of jobs. It extends Countable to provide job counting functionality.

Namespace

Chevere\Workflow\Interfaces\WorkflowInterface

Methods

jobs()

Provides access to the jobs collection.
public function jobs(): JobsInterface
return
JobsInterface
The jobs collection for this workflow

referenced()

Provides a map of response identifiers referenced from each producer job.
public function referenced(): MapInterface
The map shape:
  • key: string — producer job name (e.g. "job1")
  • value: string[] — ordered list of identifiers other jobs reference from that producer
Each identifier is either:
  • A response key when a consumer references response('job', 'key')
  • The producer job name itself when a consumer references response('job') (meaning the whole response)
Notes:
  • Entries are appended in processing order and duplicates are possible
  • This map answers “which response identifiers are referenced from job X?”
  • To find “which jobs reference job X?”, inspect jobs()->get($name)->dependencies() or build a reverse mapping from job dependencies
Example:
// job2 uses response('job1', 'response1')
// job3 uses response('job1')
$workflow->referenced()->get('job1'); // ['response1', 'job1']
return
MapInterface<string[]>
Map of producer job names to arrays of referenced identifiers

dependencies()

Provides access to the workflow dependencies.
public function dependencies(): DependenciesInterface
return
DependenciesInterface
The dependencies for this workflow

withAddedJob()

Returns an instance with the specified jobs added.
public function withAddedJob(JobInterface ...$job): self
This method MUST retain the state of the current instance and return an instance that contains the specified jobs.
job
JobInterface
required
One or more job instances to add to the workflow
return
self
New instance with the added jobs
Throws:
  • OverflowException — If adding the job would cause an overflow

parameters()

Provides access to the workflow parameters.
public function parameters(): ParametersInterface
return
ParametersInterface
The parameters interface for this workflow

Implementation

See Workflow class for the concrete implementation.

Build docs developers (and LLMs) love