@@ -59,15 +59,7 @@ public static function generate(Configuration $configuration, string $pathPrefix
5959 $ factory = new BuilderFactory ();
6060 $ stmt = $ factory ->namespace (trim ($ configuration ->namespace ->source , '\\' ));
6161
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 ();
7163
7264 if ($ configuration ->entryPoints ->call ) {
7365 $ class ->addStmt (
@@ -88,20 +80,10 @@ public static function generate(Configuration $configuration, string $pathPrefix
8880 }
8981
9082 $ class ->addStmt (
91- $ factory ->property ('hydrators ' )->setType ('Hydrators ' )->makeReadonly ()->makePrivate (),
92- )->addStmt (
9383 $ factory ->property ('routers ' )->setType ('Routers ' )->makeReadonly ()->makePrivate (),
9484 )->addStmt (
9585 $ factory ->method ('__construct ' )->makePublic ()->addParam (
9686 (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- ),
10587 )->addParam (
10688 (new Param ('browser ' ))->setType ('\\' . Browser::class),
10789 )->addStmt ((static function (Representation \Client $ client ): Node \Expr {
@@ -119,24 +101,21 @@ public static function generate(Configuration $configuration, string $pathPrefix
119101 );
120102 }
121103
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+ );
134116 })($ client ))->addStmt (
135117 new Node \Expr \Assign (
136- new Node \Expr \PropertyFetch (
137- new Node \Expr \Variable ('this ' ),
138- 'requestSchemaValidator ' ,
139- ),
118+ new Node \Expr \Variable ('requestSchemaValidator ' ),
140119 new Node \Expr \New_ (
141120 new Node \Name ('\League\OpenAPIValidation\Schema\SchemaValidator ' ),
142121 [
@@ -149,10 +128,7 @@ public static function generate(Configuration $configuration, string $pathPrefix
149128 ),
150129 )->addStmt (
151130 new Node \Expr \Assign (
152- new Node \Expr \PropertyFetch (
153- new Node \Expr \Variable ('this ' ),
154- 'responseSchemaValidator ' ,
155- ),
131+ new Node \Expr \Variable ('responseSchemaValidator ' ),
156132 new Node \Expr \New_ (
157133 new Node \Name ('\League\OpenAPIValidation\Schema\SchemaValidator ' ),
158134 [
@@ -165,10 +141,7 @@ public static function generate(Configuration $configuration, string $pathPrefix
165141 ),
166142 )->addStmt (
167143 new Node \Expr \Assign (
168- new Node \Expr \PropertyFetch (
169- new Node \Expr \Variable ('this ' ),
170- 'hydrators ' ,
171- ),
144+ new Node \Expr \Variable ('hydrators ' ),
172145 new Node \Expr \New_ (
173146 new Node \Name ('Hydrators ' ),
174147 [],
@@ -185,50 +158,35 @@ public static function generate(Configuration $configuration, string $pathPrefix
185158 new Node \Name ('Operations ' ),
186159 [
187160 new Arg (
188- new Node \Expr \PropertyFetch (
189- new Node \Expr \Variable ('this ' ),
190- 'browser ' ,
191- ),
161+ new Node \Expr \Variable ('browser ' ),
192162 false ,
193163 false ,
194164 [],
195165 new Node \Identifier ('browser ' ),
196166 ),
197167 new Arg (
198- new Node \Expr \PropertyFetch (
199- new Node \Expr \Variable ('this ' ),
200- 'authentication ' ,
201- ),
168+ new Node \Expr \Variable ('authentication ' ),
202169 false ,
203170 false ,
204171 [],
205172 new Node \Identifier ('authentication ' ),
206173 ),
207174 new Arg (
208- new Node \Expr \PropertyFetch (
209- new Node \Expr \Variable ('this ' ),
210- 'requestSchemaValidator ' ,
211- ),
175+ new Node \Expr \Variable ('requestSchemaValidator ' ),
212176 false ,
213177 false ,
214178 [],
215179 new Node \Identifier ('requestSchemaValidator ' ),
216180 ),
217181 new Arg (
218- new Node \Expr \PropertyFetch (
219- new Node \Expr \Variable ('this ' ),
220- 'responseSchemaValidator ' ,
221- ),
182+ new Node \Expr \Variable ('responseSchemaValidator ' ),
222183 false ,
223184 false ,
224185 [],
225186 new Node \Identifier ('responseSchemaValidator ' ),
226187 ),
227188 new Arg (
228- new Node \Expr \PropertyFetch (
229- new Node \Expr \Variable ('this ' ),
230- 'hydrators ' ,
231- ),
189+ new Node \Expr \Variable ('hydrators ' ),
232190 false ,
233191 false ,
234192 [],
0 commit comments