Skip to content

Commit 80b1adb

Browse files
committed
Fixed output in console + ran php-cs-fixer
1 parent 8a4e8f1 commit 80b1adb

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

src/PipelineProxy.php

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,27 @@
1818

1919
class PipelineProxy implements PipelineRuntimeInterface
2020
{
21-
/** @var list<callable> $callbacks */
21+
/** @var list<callable> */
2222
private $callback;
23-
2423
private array $callbacks = [];
25-
private readonly PipelineRuntimeInterface $decorated;
2624

2725
public function __construct(
2826
callable $callback,
29-
ConsoleOutput $output,
30-
PipelineInterface&WalkableInterface $pipeline,
31-
State\StateOutput\Workflow $state,
32-
string $filename,
33-
)
34-
{
35-
$this->decorated = new PipelineConsoleRuntime($output, $pipeline, $state->withPipeline($filename));
27+
private readonly ConsoleOutput $output,
28+
private readonly PipelineInterface&WalkableInterface $pipeline,
29+
private readonly State\StateOutput\Workflow $state,
30+
private readonly string $filename,
31+
) {
3632
$this->callback = $callback;
3733
}
3834

3935
public function extract(
4036
ExtractorInterface $extractor,
4137
RejectionInterface $rejection,
4238
StateInterface $state,
43-
): self
44-
{
45-
$this->callbacks[] = function () use ($extractor, $rejection, $state): void {
46-
$this->decorated->extract($extractor, $rejection, $state);
39+
): self {
40+
$this->callbacks[] = function (PipelineConsoleRuntime $runtime) use ($extractor, $rejection, $state): void {
41+
$runtime->extract($extractor, $rejection, $state);
4742
};
4843

4944
return $this;
@@ -53,10 +48,9 @@ public function transform(
5348
TransformerInterface $transformer,
5449
RejectionInterface $rejection,
5550
StateInterface $state,
56-
): self
57-
{
58-
$this->callbacks[] = function () use ($transformer, $rejection, $state): void {
59-
$this->decorated->transform($transformer, $rejection, $state);
51+
): self {
52+
$this->callbacks[] = function (PipelineConsoleRuntime $runtime) use ($transformer, $rejection, $state): void {
53+
$runtime->transform($transformer, $rejection, $state);
6054
};
6155

6256
return $this;
@@ -66,25 +60,26 @@ public function load(
6660
LoaderInterface $loader,
6761
RejectionInterface $rejection,
6862
StateInterface $state,
69-
): self
70-
{
71-
$this->callbacks[] = function () use ($loader, $rejection, $state): void {
72-
$this->decorated->load($loader, $rejection, $state);
63+
): self {
64+
$this->callbacks[] = function (PipelineConsoleRuntime $runtime) use ($loader, $rejection, $state): void {
65+
$runtime->load($loader, $rejection, $state);
7366
};
7467

7568
return $this;
7669
}
7770

7871
public function run(int $interval = 1000): int
7972
{
80-
($this->callback)($this->decorated);
73+
$runtime = new PipelineConsoleRuntime($this->output, $this->pipeline, $this->state->withPipeline($this->filename));
74+
75+
($this->callback)($runtime);
8176

8277
foreach ($this->callbacks as $callback) {
8378
$callback($this->callback);
8479
}
8580

8681
$this->callbacks = [];
8782

88-
return $this->decorated->run($interval);
83+
return $runtime->run($interval);
8984
}
9085
}

0 commit comments

Comments
 (0)