77use Kiboko \Component \Pipeline \Pipeline ;
88use Kiboko \Contract \Pipeline \PipelineRunnerInterface ;
99use Kiboko \Contract \Pipeline \RunnableInterface ;
10- use Kiboko \Contract \Pipeline \SchedulingInterface ;
1110use Symfony \Component \Console \Output \ConsoleOutput ;
1211
1312final class Console implements WorkflowRuntimeInterface
1413{
1514 private State \StateOutput \Workflow $ state ;
1615
16+ /** @var list<RunnableInterface> */
17+ private array $ jobs = [];
18+
1719 public function __construct (
1820 private ConsoleOutput $ output ,
19- private SchedulingInterface $ workflow ,
2021 private PipelineRunnerInterface $ pipelineRunner ,
2122 ) {
2223 $ this ->state = new State \StateOutput \Workflow ($ output );
@@ -27,22 +28,22 @@ public function loadPipeline(string $filename): PipelineConsoleRuntime
2728 $ factory = require $ filename ;
2829
2930 $ pipeline = new Pipeline ($ this ->pipelineRunner );
30- $ this ->workflow -> job ($ pipeline );
31+ $ this ->job ($ pipeline );
3132
3233 return $ factory (new PipelineConsoleRuntime ($ this ->output , $ pipeline , $ this ->state ->withPipeline (basename ($ filename ))));
3334 }
3435
3536 public function job (RunnableInterface $ job ): self
3637 {
37- $ this ->workflow -> job ( $ job) ;
38+ $ this ->jobs [] = $ job ;
3839
3940 return $ this ;
4041 }
4142
4243 public function run (int $ interval = 1000 ): int
4344 {
4445 $ count = 0 ;
45- foreach ($ this ->workflow -> walk () as $ job ) {
46+ foreach ($ this ->jobs as $ job ) {
4647 $ count = $ job ->run ($ interval );
4748 }
4849 return $ count ;
0 commit comments