@@ -137,110 +137,110 @@ public function getFiles(): array
137
137
{
138
138
return [
139
139
[
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 ' ,
143
143
//'block' => 'default',
144
144
],
145
145
[
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 ' ,
149
149
],
150
150
[
151
- 'scope ' => 'default ' ,
152
- 'destination ' => 'LICENSE ' ,
153
- 'template ' => 'php/LICENSE.twig ' ,
151
+ 'scope ' => 'default ' ,
152
+ 'destination ' => 'LICENSE ' ,
153
+ 'template ' => 'php/LICENSE.twig ' ,
154
154
],
155
155
[
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 ' ,
159
159
],
160
160
[
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 ' ,
164
164
],
165
165
[
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 ' ,
169
169
],
170
170
[
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 ' ,
174
174
],
175
175
[
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 ' ,
179
179
],
180
180
[
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 ' ,
184
184
],
185
185
[
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 ' ,
189
189
],
190
190
[
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 ' ,
194
194
],
195
195
[
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 ' ,
199
199
],
200
200
[
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 ' ,
204
204
],
205
205
[
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 ' ,
209
209
],
210
210
[
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 ' ,
214
214
],
215
215
[
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 ' ,
219
219
],
220
220
[
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 ' ,
224
224
],
225
225
[
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 ' ,
229
229
],
230
230
[
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 ' ,
234
234
],
235
235
[
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 ' ,
239
239
],
240
240
[
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 ' ,
244
244
],
245
245
];
246
246
}
@@ -258,14 +258,17 @@ public function getTypeName(array $parameter, array $spec = []): string
258
258
if (!empty ($ parameter ['enumValues ' ])) {
259
259
return \ucfirst ($ parameter ['name ' ]);
260
260
}
261
+
262
+
261
263
return match ($ parameter ['type ' ]) {
262
264
self ::TYPE_STRING => 'string ' ,
263
265
self ::TYPE_BOOLEAN => 'bool ' ,
264
266
self ::TYPE_NUMBER => 'float ' ,
265
267
self ::TYPE_INTEGER => 'int ' ,
266
268
self ::TYPE_ARRAY ,
267
269
self ::TYPE_OBJECT => 'array ' ,
268
- self ::TYPE_FILE => 'InputFile ' ,
270
+ self ::TYPE_FILE ,
271
+ self ::TYPE_PAYLOAD => 'Payload ' ,
269
272
default => $ parameter ['type ' ],
270
273
};
271
274
}
@@ -276,9 +279,9 @@ public function getTypeName(array $parameter, array $spec = []): string
276
279
*/
277
280
public function getParamDefault (array $ param ): string
278
281
{
279
- $ type = $ param ['type ' ] ?? '' ;
280
- $ default = $ param ['default ' ] ?? '' ;
281
- $ required = $ param ['required ' ] ?? '' ;
282
+ $ type = $ param ['type ' ] ?? '' ;
283
+ $ default = $ param ['default ' ] ?? '' ;
284
+ $ required = $ param ['required ' ] ?? '' ;
282
285
283
286
if ($ required ) {
284
287
return '' ;
@@ -329,8 +332,8 @@ public function getParamDefault(array $param): string
329
332
*/
330
333
public function getParamExample (array $ param ): string
331
334
{
332
- $ type = $ param ['type ' ] ?? '' ;
333
- $ example = $ param ['example ' ] ?? '' ;
335
+ $ type = $ param ['type ' ] ?? '' ;
336
+ $ example = $ param ['example ' ] ?? '' ;
334
337
335
338
$ output = '' ;
336
339
@@ -348,8 +351,11 @@ public function getParamExample(array $param): string
348
351
case self ::TYPE_OBJECT :
349
352
$ output .= '[] ' ;
350
353
break ;
354
+ case self ::TYPE_PAYLOAD :
355
+ $ output .= "Payload::fromString('<BODY>') " ;
356
+ break ;
351
357
case self ::TYPE_FILE :
352
- $ output .= "InputFile::withPath ('file.png') " ;
358
+ $ output .= "Payload::fromFile ('file.png') " ;
353
359
break ;
354
360
}
355
361
} else {
@@ -368,8 +374,11 @@ public function getParamExample(array $param): string
368
374
case self ::TYPE_STRING :
369
375
$ output .= "' {$ example }' " ;
370
376
break ;
377
+ case self ::TYPE_PAYLOAD :
378
+ $ output .= "Payload::fromJson([]) " ;
379
+ break ;
371
380
case self ::TYPE_FILE :
372
- $ output .= "InputFile::withPath ('file.png') " ;
381
+ $ output .= "Payload::fromFile ('file.png') " ;
373
382
break ;
374
383
}
375
384
}
0 commit comments