@@ -59,15 +59,7 @@ public static function generate(Configuration $configuration, string $pathPrefix
59
59
$ factory = new BuilderFactory ();
60
60
$ stmt = $ factory ->namespace (trim ($ configuration ->namespace ->source , '\\' ));
61
61
62
- $ class = $ factory ->class ('Client ' )->implement (new Node \Name ('ClientInterface ' ))->makeFinal ()->addStmt (
63
- $ factory ->property ('authentication ' )->setType ('\\' . AuthenticationInterface::class)->makeReadonly ()->makePrivate (),
64
- )->addStmt (
65
- $ factory ->property ('browser ' )->setType ('\\' . Browser::class)->makeReadonly ()->makePrivate (),
66
- )->addStmt (
67
- $ factory ->property ('requestSchemaValidator ' )->setType ('\League\OpenAPIValidation\Schema\SchemaValidator ' )->makeReadonly ()->makePrivate (),
68
- )->addStmt (
69
- $ factory ->property ('responseSchemaValidator ' )->setType ('\League\OpenAPIValidation\Schema\SchemaValidator ' )->makeReadonly ()->makePrivate (),
70
- );
62
+ $ class = $ factory ->class ('Client ' )->implement (new Node \Name ('ClientInterface ' ))->makeFinal ();
71
63
72
64
if ($ configuration ->entryPoints ->call ) {
73
65
$ class ->addStmt (
@@ -88,20 +80,10 @@ public static function generate(Configuration $configuration, string $pathPrefix
88
80
}
89
81
90
82
$ class ->addStmt (
91
- $ factory ->property ('hydrators ' )->setType ('Hydrators ' )->makeReadonly ()->makePrivate (),
92
- )->addStmt (
93
83
$ factory ->property ('routers ' )->setType ('Routers ' )->makeReadonly ()->makePrivate (),
94
84
)->addStmt (
95
85
$ factory ->method ('__construct ' )->makePublic ()->addParam (
96
86
(new Param ('authentication ' ))->setType ('\\' . AuthenticationInterface::class),
97
- )->addStmt (
98
- new Node \Expr \Assign (
99
- new Node \Expr \PropertyFetch (
100
- new Node \Expr \Variable ('this ' ),
101
- 'authentication ' ,
102
- ),
103
- new Node \Expr \Variable ('authentication ' ),
104
- ),
105
87
)->addParam (
106
88
(new Param ('browser ' ))->setType ('\\' . Browser::class),
107
89
)->addStmt ((static function (Representation \Client $ client ): Node \Expr {
@@ -119,24 +101,21 @@ public static function generate(Configuration $configuration, string $pathPrefix
119
101
);
120
102
}
121
103
122
- return new Node \Expr \Assign (new Node \ Expr \ PropertyFetch (
123
- new Node \Expr \Variable ('this ' ),
124
- ' browser ' ,
125
- ), new Node \ Expr \ MethodCall (
126
- $ assignExpr ,
127
- ' withFollowRedirects ' ,
128
- [
129
- new Arg (
130
- new Node \ Expr \ ConstFetch ( new Node \ Name ( ' false ' ) ),
131
- ) ,
132
- ] ,
133
- )) ;
104
+ return new Node \Expr \Assign (
105
+ new Node \Expr \Variable ('browser ' ),
106
+ new Node \ Expr \ MethodCall (
107
+ $ assignExpr ,
108
+ ' withFollowRedirects ' ,
109
+ [
110
+ new Arg (
111
+ new Node \ Expr \ ConstFetch ( new Node \ Name ( ' false ' )),
112
+ ),
113
+ ] ,
114
+ ) ,
115
+ );
134
116
})($ client ))->addStmt (
135
117
new Node \Expr \Assign (
136
- new Node \Expr \PropertyFetch (
137
- new Node \Expr \Variable ('this ' ),
138
- 'requestSchemaValidator ' ,
139
- ),
118
+ new Node \Expr \Variable ('requestSchemaValidator ' ),
140
119
new Node \Expr \New_ (
141
120
new Node \Name ('\League\OpenAPIValidation\Schema\SchemaValidator ' ),
142
121
[
@@ -149,10 +128,7 @@ public static function generate(Configuration $configuration, string $pathPrefix
149
128
),
150
129
)->addStmt (
151
130
new Node \Expr \Assign (
152
- new Node \Expr \PropertyFetch (
153
- new Node \Expr \Variable ('this ' ),
154
- 'responseSchemaValidator ' ,
155
- ),
131
+ new Node \Expr \Variable ('responseSchemaValidator ' ),
156
132
new Node \Expr \New_ (
157
133
new Node \Name ('\League\OpenAPIValidation\Schema\SchemaValidator ' ),
158
134
[
@@ -165,10 +141,7 @@ public static function generate(Configuration $configuration, string $pathPrefix
165
141
),
166
142
)->addStmt (
167
143
new Node \Expr \Assign (
168
- new Node \Expr \PropertyFetch (
169
- new Node \Expr \Variable ('this ' ),
170
- 'hydrators ' ,
171
- ),
144
+ new Node \Expr \Variable ('hydrators ' ),
172
145
new Node \Expr \New_ (
173
146
new Node \Name ('Hydrators ' ),
174
147
[],
@@ -185,50 +158,35 @@ public static function generate(Configuration $configuration, string $pathPrefix
185
158
new Node \Name ('Operations ' ),
186
159
[
187
160
new Arg (
188
- new Node \Expr \PropertyFetch (
189
- new Node \Expr \Variable ('this ' ),
190
- 'browser ' ,
191
- ),
161
+ new Node \Expr \Variable ('browser ' ),
192
162
false ,
193
163
false ,
194
164
[],
195
165
new Node \Identifier ('browser ' ),
196
166
),
197
167
new Arg (
198
- new Node \Expr \PropertyFetch (
199
- new Node \Expr \Variable ('this ' ),
200
- 'authentication ' ,
201
- ),
168
+ new Node \Expr \Variable ('authentication ' ),
202
169
false ,
203
170
false ,
204
171
[],
205
172
new Node \Identifier ('authentication ' ),
206
173
),
207
174
new Arg (
208
- new Node \Expr \PropertyFetch (
209
- new Node \Expr \Variable ('this ' ),
210
- 'requestSchemaValidator ' ,
211
- ),
175
+ new Node \Expr \Variable ('requestSchemaValidator ' ),
212
176
false ,
213
177
false ,
214
178
[],
215
179
new Node \Identifier ('requestSchemaValidator ' ),
216
180
),
217
181
new Arg (
218
- new Node \Expr \PropertyFetch (
219
- new Node \Expr \Variable ('this ' ),
220
- 'responseSchemaValidator ' ,
221
- ),
182
+ new Node \Expr \Variable ('responseSchemaValidator ' ),
222
183
false ,
223
184
false ,
224
185
[],
225
186
new Node \Identifier ('responseSchemaValidator ' ),
226
187
),
227
188
new Arg (
228
- new Node \Expr \PropertyFetch (
229
- new Node \Expr \Variable ('this ' ),
230
- 'hydrators ' ,
231
- ),
189
+ new Node \Expr \Variable ('hydrators ' ),
232
190
false ,
233
191
false ,
234
192
[],
0 commit comments