|
15 | 15 | use ApiClients\Tools\OpenApiClientGenerator\Utils;
|
16 | 16 | use EventSauce\ObjectHydrator\ObjectMapper;
|
17 | 17 | use Jawira\CaseConverter\Convert;
|
| 18 | +use NumberToWords\NumberToWords; |
18 | 19 | use PhpParser\Builder\Method;
|
19 | 20 | use PhpParser\Builder\Param;
|
20 | 21 | use PhpParser\BuilderFactory;
|
@@ -353,30 +354,14 @@ public static function generate(Configuration $configuration, string $pathPrefix
|
353 | 354 | }
|
354 | 355 | }
|
355 | 356 |
|
356 |
| -// new Node\Stmt\Switch_( |
357 |
| -// new Node\Expr\Variable('method'), |
358 |
| -// iterator_to_array((function (array $sortedOperations) use ($factory): iterable { |
359 |
| -// foreach ($sortedOperations as $method => $operation) { |
360 |
| -// yield new Node\Stmt\Case_( |
361 |
| -// new Node\Scalar\String_($method), |
362 |
| -// [ |
363 |
| -// ...self::traverseOperations($operation['operations'], $operation['paths'], 0), |
364 |
| -// new Node\Stmt\Break_(), |
365 |
| -// ], |
366 |
| -// ); |
367 |
| -// } |
368 |
| -// })($sortedOperations)) |
369 |
| -// ) |
370 |
| - |
371 |
| - |
372 | 357 | if ($configuration->entryPoints->call) {
|
373 | 358 | $chunkCountClasses = [];
|
374 | 359 | $operationsIfs = [];
|
375 | 360 | foreach ($sortedOperations as $method => $ops) {
|
376 | 361 | $opsTmts = [];
|
377 | 362 | foreach ($ops as $chunkCount => $moar) {
|
378 | 363 | $chunkCountClasses[] = $cc = new ChunkCount(
|
379 |
| - 'ChunkSize\\' . (new Convert($method))->toPascal() . '\\' . (new Convert('cc' . $chunkCount))->toPascal(), |
| 364 | + 'Router\\' . (new Convert($method))->toPascal() . '\\' . (new Convert(NumberToWords::transformNumber('en', $chunkCount)))->toPascal(), |
380 | 365 | self::traverseOperations($namespace, $moar['operations'], $moar['paths'], 0, $routers),
|
381 | 366 | );
|
382 | 367 |
|
@@ -734,7 +719,7 @@ public static function generate(Configuration $configuration, string $pathPrefix
|
734 | 719 | }
|
735 | 720 |
|
736 | 721 | foreach ($chunkCountClasses as $chunkCountClass) {
|
737 |
| - yield from self::createChunkCount( |
| 722 | + yield from self::createRouterChunkSize( |
738 | 723 | $pathPrefix,
|
739 | 724 | $namespace,
|
740 | 725 | $chunkCountClass,
|
@@ -1284,7 +1269,7 @@ private static function createRouter(string $pathPrefix, string $namespace, Rout
|
1284 | 1269 | *
|
1285 | 1270 | * @return iterable<File>
|
1286 | 1271 | */
|
1287 |
| - private static function createChunkCount(string $pathPrefix, string $namespace, ChunkCount $chunkCount, Method $constructor, array $properties): iterable |
| 1272 | + private static function createRouterChunkSize(string $pathPrefix, string $namespace, ChunkCount $chunkCount, Method $constructor, array $properties): iterable |
1288 | 1273 | {
|
1289 | 1274 | $factory = new BuilderFactory();
|
1290 | 1275 | $stmt = $factory->namespace(trim(Utils::dirname($namespace . $chunkCount->className), '\\'));
|
|
0 commit comments