44
55namespace Kiboko \Component \Flow \RabbitMQ ;
66
7- use Kiboko \Contract \Pipeline \StateInterface ;
7+ use Kiboko \Contract \Pipeline \StepCodeInterface ;
8+ use Kiboko \Contract \Pipeline \StepStateInterface ;
89
9- final class State implements StateInterface
10+ final class State implements StepStateInterface
1011{
12+ private array $ steps = [];
1113 private int $ acceptMetric = 0 ;
1214 private int $ rejectMetric = 0 ;
1315 private int $ errorMetric = 0 ;
@@ -19,37 +21,25 @@ public function __construct(
1921 ) {
2022 }
2123
22- public function initialize (int $ start = 0 ): void
24+ public function accept (int $ count = 1 ): void
2325 {
24- $ this ->acceptMetric = 0 ;
25- $ this ->rejectMetric = 0 ;
26- $ this ->errorMetric = 0 ;
27- }
28-
29- public function accept (int $ step = 1 ): void
30- {
31- $ this ->acceptMetric += $ step ;
26+ $ this ->acceptMetric += $ count ;
3227
33- $ this ->manager ->trySend ($ step );
28+ $ this ->manager ->trySend ($ this -> stepCode );
3429 }
3530
36- public function reject (int $ step = 1 ): void
31+ public function reject (int $ count = 1 ): void
3732 {
38- $ this ->rejectMetric += $ step ;
33+ $ this ->rejectMetric += $ count ;
3934
40- $ this ->manager ->trySend ($ step );
35+ $ this ->manager ->trySend ($ this -> stepCode );
4136 }
4237
43- public function error (int $ step = 1 ): void
38+ public function error (int $ count = 1 ): void
4439 {
45- $ this ->errorMetric += $ step ;
40+ $ this ->errorMetric += $ count ;
4641
47- $ this ->manager ->trySend ($ step );
48- }
49-
50- public function teardown (): void
51- {
52- $ this ->manager ->teardown ($ this );
42+ $ this ->manager ->trySend ($ this ->stepCode );
5343 }
5444
5545 public function toArray (): array
0 commit comments