@@ -137,110 +137,110 @@ public function getFiles(): array
137137 {
138138 return [
139139 [
140- 'scope ' => 'default ' ,
141- 'destination ' => 'README.md ' ,
142- 'template ' => 'php/README.md.twig ' ,
140+ 'scope ' => 'default ' ,
141+ 'destination ' => 'README.md ' ,
142+ 'template ' => 'php/README.md.twig ' ,
143143 //'block' => 'default',
144144 ],
145145 [
146- 'scope ' => 'default ' ,
147- 'destination ' => 'CHANGELOG.md ' ,
148- 'template ' => 'php/CHANGELOG.md.twig ' ,
146+ 'scope ' => 'default ' ,
147+ 'destination ' => 'CHANGELOG.md ' ,
148+ 'template ' => 'php/CHANGELOG.md.twig ' ,
149149 ],
150150 [
151- 'scope ' => 'default ' ,
152- 'destination ' => 'LICENSE ' ,
153- 'template ' => 'php/LICENSE.twig ' ,
151+ 'scope ' => 'default ' ,
152+ 'destination ' => 'LICENSE ' ,
153+ 'template ' => 'php/LICENSE.twig ' ,
154154 ],
155155 [
156- 'scope ' => 'default ' ,
157- 'destination ' => 'composer.json ' ,
158- 'template ' => 'php/composer.json.twig ' ,
156+ 'scope ' => 'default ' ,
157+ 'destination ' => 'composer.json ' ,
158+ 'template ' => 'php/composer.json.twig ' ,
159159 ],
160160 [
161- 'scope ' => 'service ' ,
162- 'destination ' => 'docs/{{service.name | caseLower}}.md ' ,
163- 'template ' => 'php/docs/service.md.twig ' ,
161+ 'scope ' => 'service ' ,
162+ 'destination ' => 'docs/{{service.name | caseLower}}.md ' ,
163+ 'template ' => 'php/docs/service.md.twig ' ,
164164 ],
165165 [
166- 'scope ' => 'method ' ,
167- 'destination ' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md ' ,
168- 'template ' => 'php/docs/example.md.twig ' ,
166+ 'scope ' => 'method ' ,
167+ 'destination ' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md ' ,
168+ 'template ' => 'php/docs/example.md.twig ' ,
169169 ],
170170 [
171- 'scope ' => 'default ' ,
172- 'destination ' => 'src/{{ spec.title | caseUcfirst}}/Client.php ' ,
173- 'template ' => 'php/src/Client.php.twig ' ,
171+ 'scope ' => 'default ' ,
172+ 'destination ' => 'src/{{ spec.title | caseUcfirst}}/Client.php ' ,
173+ 'template ' => 'php/src/Client.php.twig ' ,
174174 ],
175175 [
176- 'scope ' => 'default ' ,
177- 'destination ' => 'src/{{ spec.title | caseUcfirst}}/Permission.php ' ,
178- 'template ' => 'php/src/Permission.php.twig ' ,
176+ 'scope ' => 'default ' ,
177+ 'destination ' => 'src/{{ spec.title | caseUcfirst}}/Permission.php ' ,
178+ 'template ' => 'php/src/Permission.php.twig ' ,
179179 ],
180180 [
181- 'scope ' => 'default ' ,
182- 'destination ' => 'tests/{{ spec.title | caseUcfirst}}/PermissionTest.php ' ,
183- 'template ' => 'php/tests/PermissionTest.php.twig ' ,
181+ 'scope ' => 'default ' ,
182+ 'destination ' => 'tests/{{ spec.title | caseUcfirst}}/PermissionTest.php ' ,
183+ 'template ' => 'php/tests/PermissionTest.php.twig ' ,
184184 ],
185185 [
186- 'scope ' => 'default ' ,
187- 'destination ' => 'src/{{ spec.title | caseUcfirst}}/Role.php ' ,
188- 'template ' => 'php/src/Role.php.twig ' ,
186+ 'scope ' => 'default ' ,
187+ 'destination ' => 'src/{{ spec.title | caseUcfirst}}/Role.php ' ,
188+ 'template ' => 'php/src/Role.php.twig ' ,
189189 ],
190190 [
191- 'scope ' => 'default ' ,
192- 'destination ' => 'tests/{{ spec.title | caseUcfirst}}/RoleTest.php ' ,
193- 'template ' => 'php/tests/RoleTest.php.twig ' ,
191+ 'scope ' => 'default ' ,
192+ 'destination ' => 'tests/{{ spec.title | caseUcfirst}}/RoleTest.php ' ,
193+ 'template ' => 'php/tests/RoleTest.php.twig ' ,
194194 ],
195195 [
196- 'scope ' => 'default ' ,
197- 'destination ' => 'src/{{ spec.title | caseUcfirst}}/ID.php ' ,
198- 'template ' => 'php/src/ID.php.twig ' ,
196+ 'scope ' => 'default ' ,
197+ 'destination ' => 'src/{{ spec.title | caseUcfirst}}/ID.php ' ,
198+ 'template ' => 'php/src/ID.php.twig ' ,
199199 ],
200200 [
201- 'scope ' => 'default ' ,
202- 'destination ' => 'tests/{{ spec.title | caseUcfirst}}/IDTest.php ' ,
203- 'template ' => 'php/tests/IDTest.php.twig ' ,
201+ 'scope ' => 'default ' ,
202+ 'destination ' => 'tests/{{ spec.title | caseUcfirst}}/IDTest.php ' ,
203+ 'template ' => 'php/tests/IDTest.php.twig ' ,
204204 ],
205205 [
206- 'scope ' => 'default ' ,
207- 'destination ' => 'src/{{ spec.title | caseUcfirst}}/Query.php ' ,
208- 'template ' => 'php/src/Query.php.twig ' ,
206+ 'scope ' => 'default ' ,
207+ 'destination ' => 'src/{{ spec.title | caseUcfirst}}/Query.php ' ,
208+ 'template ' => 'php/src/Query.php.twig ' ,
209209 ],
210210 [
211- 'scope ' => 'default ' ,
212- 'destination ' => 'tests/{{ spec.title | caseUcfirst}}/QueryTest.php ' ,
213- 'template ' => 'php/tests/QueryTest.php.twig ' ,
211+ 'scope ' => 'default ' ,
212+ 'destination ' => 'tests/{{ spec.title | caseUcfirst}}/QueryTest.php ' ,
213+ 'template ' => 'php/tests/QueryTest.php.twig ' ,
214214 ],
215215 [
216- 'scope ' => 'default ' ,
217- 'destination ' => 'src/{{ spec.title | caseUcfirst}}/InputFile .php ' ,
218- 'template ' => 'php/src/InputFile .php.twig ' ,
216+ 'scope ' => 'default ' ,
217+ 'destination ' => 'src/{{ spec.title | caseUcfirst}}/Payload .php ' ,
218+ 'template ' => 'php/src/Payload .php.twig ' ,
219219 ],
220220 [
221- 'scope ' => 'default ' ,
222- 'destination ' => 'src/{{ spec.title | caseUcfirst}}/{{ spec.title | caseUcfirst}}Exception.php ' ,
223- 'template ' => 'php/src/Exception.php.twig ' ,
221+ 'scope ' => 'default ' ,
222+ 'destination ' => 'src/{{ spec.title | caseUcfirst}}/{{ spec.title | caseUcfirst}}Exception.php ' ,
223+ 'template ' => 'php/src/Exception.php.twig ' ,
224224 ],
225225 [
226- 'scope ' => 'default ' ,
227- 'destination ' => '/src/{{ spec.title | caseUcfirst}}/Service.php ' ,
228- 'template ' => 'php/src/Service.php.twig ' ,
226+ 'scope ' => 'default ' ,
227+ 'destination ' => '/src/{{ spec.title | caseUcfirst}}/Service.php ' ,
228+ 'template ' => 'php/src/Service.php.twig ' ,
229229 ],
230230 [
231- 'scope ' => 'service ' ,
232- 'destination ' => '/src/{{ spec.title | caseUcfirst}}/Services/{{service.name | caseUcfirst}}.php ' ,
233- 'template ' => 'php/src/Services/Service.php.twig ' ,
231+ 'scope ' => 'service ' ,
232+ 'destination ' => '/src/{{ spec.title | caseUcfirst}}/Services/{{service.name | caseUcfirst}}.php ' ,
233+ 'template ' => 'php/src/Services/Service.php.twig ' ,
234234 ],
235235 [
236- 'scope ' => 'service ' ,
237- 'destination ' => '/tests/{{ spec.title | caseUcfirst}}/Services/{{service.name | caseUcfirst}}Test.php ' ,
238- 'template ' => 'php/tests/Services/ServiceTest.php.twig ' ,
236+ 'scope ' => 'service ' ,
237+ 'destination ' => '/tests/{{ spec.title | caseUcfirst}}/Services/{{service.name | caseUcfirst}}Test.php ' ,
238+ 'template ' => 'php/tests/Services/ServiceTest.php.twig ' ,
239239 ],
240240 [
241- 'scope ' => 'enum ' ,
242- 'destination ' => '/src/{{ spec.title | caseUcfirst}}/Enums/{{ enum.name | caseUcfirst }}.php ' ,
243- 'template ' => 'php/src/Enums/Enum.php.twig ' ,
241+ 'scope ' => 'enum ' ,
242+ 'destination ' => '/src/{{ spec.title | caseUcfirst}}/Enums/{{ enum.name | caseUcfirst }}.php ' ,
243+ 'template ' => 'php/src/Enums/Enum.php.twig ' ,
244244 ],
245245 ];
246246 }
@@ -258,14 +258,17 @@ public function getTypeName(array $parameter, array $spec = []): string
258258 if (!empty ($ parameter ['enumValues ' ])) {
259259 return \ucfirst ($ parameter ['name ' ]);
260260 }
261+
262+
261263 return match ($ parameter ['type ' ]) {
262264 self ::TYPE_STRING => 'string ' ,
263265 self ::TYPE_BOOLEAN => 'bool ' ,
264266 self ::TYPE_NUMBER => 'float ' ,
265267 self ::TYPE_INTEGER => 'int ' ,
266268 self ::TYPE_ARRAY ,
267269 self ::TYPE_OBJECT => 'array ' ,
268- self ::TYPE_FILE => 'InputFile ' ,
270+ self ::TYPE_FILE ,
271+ self ::TYPE_PAYLOAD => 'Payload ' ,
269272 default => $ parameter ['type ' ],
270273 };
271274 }
@@ -276,9 +279,9 @@ public function getTypeName(array $parameter, array $spec = []): string
276279 */
277280 public function getParamDefault (array $ param ): string
278281 {
279- $ type = $ param ['type ' ] ?? '' ;
280- $ default = $ param ['default ' ] ?? '' ;
281- $ required = $ param ['required ' ] ?? '' ;
282+ $ type = $ param ['type ' ] ?? '' ;
283+ $ default = $ param ['default ' ] ?? '' ;
284+ $ required = $ param ['required ' ] ?? '' ;
282285
283286 if ($ required ) {
284287 return '' ;
@@ -329,8 +332,8 @@ public function getParamDefault(array $param): string
329332 */
330333 public function getParamExample (array $ param ): string
331334 {
332- $ type = $ param ['type ' ] ?? '' ;
333- $ example = $ param ['example ' ] ?? '' ;
335+ $ type = $ param ['type ' ] ?? '' ;
336+ $ example = $ param ['example ' ] ?? '' ;
334337
335338 $ output = '' ;
336339
@@ -348,8 +351,11 @@ public function getParamExample(array $param): string
348351 case self ::TYPE_OBJECT :
349352 $ output .= '[] ' ;
350353 break ;
354+ case self ::TYPE_PAYLOAD :
355+ $ output .= "Payload::fromString('<BODY>') " ;
356+ break ;
351357 case self ::TYPE_FILE :
352- $ output .= "InputFile::withPath ('file.png') " ;
358+ $ output .= "Payload::fromFile ('file.png') " ;
353359 break ;
354360 }
355361 } else {
@@ -368,8 +374,11 @@ public function getParamExample(array $param): string
368374 case self ::TYPE_STRING :
369375 $ output .= "' {$ example }' " ;
370376 break ;
377+ case self ::TYPE_PAYLOAD :
378+ $ output .= "Payload::fromJson([]) " ;
379+ break ;
371380 case self ::TYPE_FILE :
372- $ output .= "InputFile::withPath ('file.png') " ;
381+ $ output .= "Payload::fromFile ('file.png') " ;
373382 break ;
374383 }
375384 }
0 commit comments