Skip to content

warmans/pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pipeline

Build Status Code Coverage Scrutinizer Code Quality

Create a task pipline for seperating complex operations into smaller testable units.

Sample useage:

use Pipeline\Pipeline;
use Pipeline\Workload;
use Pipeline\Workload\Task;
use Pipeline\Stage\CallbackStage;

//setup two tasks
$workload = new Workload();
$workload->addTask(new Workload\Task('foo'));
$workload->addTask(new Workload\Task('bar'));

//setup a pipeline
$pipeline = new Pipeline();

//setup two stages
$pipeline->addStage(new CallbackStage('first-stage', function (Task $task) {
    $task->setMeta('done-first', true);
}));
$pipeline->addStage(new CallbackStage('second-stage', function (Task $task) {
    $task->setMeta('done-second', true);
}));

//setup the context to enable logging
$context = new Context();
$context->setLogger(function($msg, $writeLn=true) {
    echo $msg . ($writeLn ? "\n" : "");
});

//execute
$pipeline->execute($workload, $context);

var_dump($workload);

About

Create a task pipline for seperating complex operations into smaller testable units

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages