@@ -16,10 +16,6 @@ final class Drop implements StepBuilderInterface
16
16
/** @var list<?Node\Expr> */
17
17
private array $ exclusions = [];
18
18
19
- public function __construct ()
20
- {
21
- }
22
-
23
19
public function withLogger (Node \Expr $ logger ): self
24
20
{
25
21
$ this ->logger = $ logger ;
@@ -41,55 +37,13 @@ public function withState(Node\Expr $state): self
41
37
return $ this ;
42
38
}
43
39
44
- public function withExclusions (Node \ Expr ...$ exclusions ): self
40
+ public function withExclusions (Node ...$ exclusions ): self
45
41
{
46
42
array_push ($ this ->exclusions , ...$ exclusions );
47
43
48
44
return $ this ;
49
45
}
50
46
51
- private function buildExclusions (Node \Expr ...$ exclusions ): Node \Expr
52
- {
53
- if (\count ($ exclusions ) > 3 ) {
54
- $ length = \count ($ exclusions );
55
- $ middle = (int ) floor ($ length / 2 );
56
- $ left = \array_slice ($ exclusions , 0 , $ middle );
57
- $ right = \array_slice ($ exclusions , $ middle , $ length );
58
-
59
- return new Node \Expr \BinaryOp \BooleanAnd (
60
- $ this ->buildExclusions (...$ left ),
61
- $ this ->buildExclusions (...$ right ),
62
- );
63
- }
64
-
65
- if (\count ($ exclusions ) > 2 ) {
66
- $ right = array_shift ($ exclusions );
67
-
68
- return new Node \Expr \BinaryOp \BooleanAnd (
69
- $ this ->buildExclusions (...$ exclusions ),
70
- $ right ,
71
- );
72
- }
73
-
74
- if (\count ($ exclusions ) > 1 ) {
75
- $ left = array_pop ($ exclusions );
76
- $ right = array_pop ($ exclusions );
77
-
78
- return new Node \Expr \BinaryOp \BooleanAnd (
79
- $ left ,
80
- $ right ,
81
- );
82
- }
83
-
84
- if (\count ($ exclusions ) > 0 ) {
85
- return array_pop ($ exclusions );
86
- }
87
-
88
- return new Node \Expr \ConstFetch (
89
- new Node \Name ('false ' ),
90
- );
91
- }
92
-
93
47
public function getNode (): Node
94
48
{
95
49
return new Node \Expr \New_ (
@@ -113,24 +67,7 @@ class: new Node\Stmt\Class_(null, [
113
67
new Node \Name ('true ' ),
114
68
),
115
69
[
116
- new Node \Stmt \If_ (
117
- $ this ->buildExclusions (...$ this ->exclusions ),
118
- [
119
- 'stmts ' => [
120
- new Node \Stmt \Expression (
121
- new Node \Expr \Assign (
122
- new Node \Expr \Variable ('input ' ),
123
- new Node \Expr \Yield_ (
124
- new Node \Expr \New_ (
125
- new Node \Name \FullyQualified ('Kiboko \\Component \\Bucket \\RejectionResultBucket ' ),
126
- ),
127
- ),
128
- ),
129
- ),
130
- new Node \Stmt \Continue_ (),
131
- ],
132
- ]
133
- ),
70
+ ...$ this ->exclusions ,
134
71
new Node \Stmt \Expression (
135
72
new Node \Expr \Assign (
136
73
new Node \Expr \Variable ('input ' ),
@@ -146,11 +83,6 @@ class: new Node\Stmt\Class_(null, [
146
83
),
147
84
],
148
85
),
149
- new Node \Stmt \Expression (
150
- new Node \Expr \Yield_ (
151
- new Node \Expr \Variable ('input ' )
152
- ),
153
- ),
154
86
])
155
87
->getNode (),
156
88
],
0 commit comments