warmans / pipeline
There is no license information available for the latest version (0.0.3) of this package.
Framework for creating task pipelines
0.0.3
2014-09-02 09:27 UTC
Requires (Dev)
- phpunit/phpunit: ~4.1.0
- squizlabs/php_codesniffer: 1.*
This package is not auto-updated.
Last update: 2024-12-17 03:32:04 UTC
README
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);