25
25
use ApiClients \Tools \OpenApiClientGenerator \StatusOutput \Step ;
26
26
use cebe \openapi \Reader ;
27
27
use cebe \openapi \spec \OpenApi ;
28
- use DivineOmega \CliProgressBar \ProgressBar ;
29
28
use EventSauce \ObjectHydrator \ObjectMapperUsingReflection ;
30
29
use PhpParser \Node ;
31
30
use PhpParser \PrettyPrinter \Standard ;
32
- use Psr \Log \LoggerInterface ;
33
31
use RuntimeException ;
34
32
35
33
use function array_filter ;
@@ -129,7 +127,7 @@ public function __construct(
129
127
$ this ->state ->specHash === $ this ->currentSpecHash &&
130
128
(static function (string $ root , Files $ files , string ...$ additionalFiles ): bool {
131
129
foreach ($ additionalFiles as $ additionalFile ) {
132
- if ($ files ->has ($ additionalFile ) && (!file_exists ($ root . $ additionalFile ) || $ files ->get ($ additionalFile )->hash !== md5 (file_get_contents ($ root . $ additionalFile )))) {
130
+ if ($ files ->has ($ additionalFile ) && (! file_exists ($ root . $ additionalFile ) || $ files ->get ($ additionalFile )->hash !== md5 (file_get_contents ($ root . $ additionalFile )))) {
133
131
echo $ additionalFile , PHP_EOL ;
134
132
135
133
return false ;
@@ -255,6 +253,7 @@ private function all(string $namespace, string $namespaceTest, string $configura
255
253
$ this ->statusOutput ->advanceStep ('gathering_schemas ' );
256
254
}
257
255
}
256
+
258
257
$ this ->statusOutput ->markStepDone ('gathering_schemas ' );
259
258
260
259
$ webHooks = [];
@@ -266,9 +265,11 @@ private function all(string $namespace, string $namespaceTest, string $configura
266
265
$ webHooks [$ webHookje ->event ] = [];
267
266
}
268
267
269
- $ webHooks [$ webHookje ->event ][] = $ webHookje ;$ this ->statusOutput ->advanceStep ('gathering_webhooks ' );
268
+ $ webHooks [$ webHookje ->event ][] = $ webHookje ;
269
+ $ this ->statusOutput ->advanceStep ('gathering_webhooks ' );
270
270
}
271
271
}
272
+
272
273
$ this ->statusOutput ->markStepDone ('gathering_webhooks ' );
273
274
274
275
$ paths = [];
@@ -285,10 +286,11 @@ private function all(string $namespace, string $namespaceTest, string $configura
285
286
continue ;
286
287
}
287
288
288
- $ paths [] = \ApiClients \Tools \OpenApiClientGenerator \Gatherer \Path::gather ($ pathClassName , $ path , $ pathItem , $ schemaRegistry , $ this ->configuration ->voter );
289
+ $ paths [] = \ApiClients \Tools \OpenApiClientGenerator \Gatherer \Path::gather ($ pathClassName , $ path , $ pathItem , $ schemaRegistry , $ this ->configuration ->voter );
289
290
$ webHooks [$ webHookje ->event ][] = $ webHookje ;
290
291
$ this ->statusOutput ->advanceStep ('gathering_paths ' );
291
292
}
293
+
292
294
$ this ->statusOutput ->markStepDone ('gathering_paths ' );
293
295
}
294
296
@@ -316,8 +318,8 @@ private function all(string $namespace, string $namespaceTest, string $configura
316
318
317
319
private function oneClient (string $ namespace , string $ namespaceTest , string $ configurationLocation , SchemaRegistry $ schemaRegistry , ThrowableSchema $ throwableSchemaRegistry , array $ schemas , array $ paths , array $ webHooks )
318
320
{
319
- $ hydrators = [];
320
- $ operations = [];
321
+ $ hydrators = [];
322
+ $ operations = [];
321
323
$ this ->statusOutput ->itemForStep ('generating_operations ' , count ($ paths ));
322
324
foreach ($ paths as $ path ) {
323
325
$ hydrators [] = $ path ->hydrator ;
@@ -345,6 +347,7 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
345
347
346
348
$ this ->statusOutput ->advanceStep ('generating_operations ' );
347
349
}
350
+
348
351
$ this ->statusOutput ->markStepDone ('generating_operations ' );
349
352
350
353
$ unknownSchemaCount = 0 ;
@@ -357,6 +360,7 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
357
360
$ this ->statusOutput ->advanceStep ('gathering_unknown_schemas ' );
358
361
}
359
362
}
363
+
360
364
$ this ->statusOutput ->markStepDone ('gathering_unknown_schemas ' );
361
365
362
366
$ this ->statusOutput ->itemForStep ('generating_schemas ' , count ($ schemas ));
@@ -375,20 +379,24 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
375
379
$ schema ,
376
380
);
377
381
}
382
+
378
383
$ this ->statusOutput ->advanceStep ('generating_schemas ' );
379
384
}
385
+
380
386
$ this ->statusOutput ->markStepDone ('generating_schemas ' );
381
387
382
388
$ client = \ApiClients \Tools \OpenApiClientGenerator \Gatherer \Client::gather ($ this ->spec , ...$ paths );
383
389
384
390
$ this ->statusOutput ->markStepDone ('generating_clientinterface ' );
391
+
385
392
yield from ClientInterface::generate (
386
393
$ this ->configuration ->destination ->source . DIRECTORY_SEPARATOR ,
387
394
$ namespace ,
388
395
$ operations ,
389
396
);
390
397
391
398
$ this ->statusOutput ->markStepDone ('generating_client ' );
399
+
392
400
yield from Client::generate (
393
401
$ this ->configuration ->destination ->source . DIRECTORY_SEPARATOR ,
394
402
$ namespace ,
@@ -410,11 +418,14 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
410
418
$ schemaRegistry ,
411
419
...$ webHook ,
412
420
);
421
+
413
422
$ this ->statusOutput ->advanceStep ('generating_webhooks ' );
414
423
}
424
+
415
425
$ this ->statusOutput ->markStepDone ('generating_webhooks ' );
416
426
417
427
$ this ->statusOutput ->markStepDone ('generating_webhooks_entry_point ' );
428
+
418
429
yield from WebHooks::generate ($ this ->configuration ->destination ->source . DIRECTORY_SEPARATOR , $ namespace , $ webHooksHydrators , $ webHooks );
419
430
420
431
$ this ->statusOutput ->itemForStep ('generating_hydrators ' , count ($ hydrators ));
@@ -423,9 +434,11 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
423
434
424
435
$ this ->statusOutput ->advanceStep ('generating_hydrators ' );
425
436
}
437
+
426
438
$ this ->statusOutput ->markStepDone ('generating_hydrators ' );
427
439
428
440
$ this ->statusOutput ->markStepDone ('generating_hydrators_entry_point ' );
441
+
429
442
yield from Hydrators::generate ($ this ->configuration ->destination ->source . DIRECTORY_SEPARATOR , $ namespace , ...$ hydrators );
430
443
431
444
$ this ->statusOutput ->markStepDone ('generating_templated_files ' );
@@ -447,9 +460,9 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
447
460
*/
448
461
private function subSplitClient (string $ namespace , string $ namespaceTest , string $ configurationLocation , SchemaRegistry $ schemaRegistry , ThrowableSchema $ throwableSchemaRegistry , array $ schemas , array $ paths , array $ webHooks )
449
462
{
450
- $ splits = [];
451
- $ hydrators = [];
452
- $ operations = [];
463
+ $ splits = [];
464
+ $ hydrators = [];
465
+ $ operations = [];
453
466
$ this ->statusOutput ->itemForStep ('generating_operations ' , count ($ paths ));
454
467
foreach ($ paths as $ path ) {
455
468
foreach ($ this ->configuration ->subSplit ->sectionGenerator as $ generator ) {
@@ -482,8 +495,10 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
482
495
$ this ->configuration ,
483
496
);
484
497
}
498
+
485
499
$ this ->statusOutput ->advanceStep ('generating_operations ' );
486
500
}
501
+
487
502
$ this ->statusOutput ->markStepDone ('generating_operations ' );
488
503
489
504
$ webHooksHydrators = [];
@@ -512,6 +527,7 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
512
527
$ this ->statusOutput ->advanceStep ('gathering_unknown_schemas ' );
513
528
}
514
529
}
530
+
515
531
$ this ->statusOutput ->markStepDone ('gathering_unknown_schemas ' );
516
532
517
533
$ sortedSchemas = [];
@@ -575,20 +591,24 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
575
591
$ aliases ,
576
592
);
577
593
}
594
+
578
595
$ this ->statusOutput ->advanceStep ('generating_schemas ' );
579
596
}
597
+
580
598
$ this ->statusOutput ->markStepDone ('generating_schemas ' );
581
599
582
600
$ client = \ApiClients \Tools \OpenApiClientGenerator \Gatherer \Client::gather ($ this ->spec , ...$ paths );
583
601
584
602
$ this ->statusOutput ->markStepDone ('generating_clientinterface ' );
603
+
585
604
yield from ClientInterface::generate (
586
605
$ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->rootPackage , '' ) . $ this ->configuration ->destination ->source ,
587
606
$ namespace ,
588
607
$ operations ,
589
608
);
590
609
591
610
$ this ->statusOutput ->markStepDone ('generating_client ' );
611
+
592
612
yield from Client::generate (
593
613
$ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->rootPackage , '' ) . $ this ->configuration ->destination ->source ,
594
614
$ namespace ,
@@ -613,11 +633,14 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
613
633
$ schemaRegistry ,
614
634
...$ webHook ,
615
635
);
636
+
616
637
$ this ->statusOutput ->advanceStep ('generating_webhooks ' );
617
638
}
639
+
618
640
$ this ->statusOutput ->markStepDone ('generating_webhooks ' );
619
641
620
642
$ this ->statusOutput ->markStepDone ('generating_webhooks_entry_point ' );
643
+
621
644
yield from WebHooks::generate (
622
645
$ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->rootPackage , '' ) . $ this ->configuration ->destination ->source ,
623
646
$ namespace ,
@@ -634,11 +657,14 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
634
657
$ hydrator
635
658
);
636
659
}
660
+
637
661
$ this ->statusOutput ->advanceStep ('generating_hydrators ' );
638
662
}
663
+
639
664
$ this ->statusOutput ->markStepDone ('generating_hydrators ' );
640
665
641
666
$ this ->statusOutput ->markStepDone ('generating_hydrators_entry_point ' );
667
+
642
668
yield from Hydrators::generate (
643
669
$ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->rootPackage , '' ) . $ this ->configuration ->destination ->source ,
644
670
$ namespace ,
@@ -739,6 +765,7 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
739
765
);
740
766
$ this ->statusOutput ->advanceStep ('generating_templates_files_subsplit_package ' );
741
767
}
768
+
742
769
$ this ->statusOutput ->markStepDone ('generating_templates_files_subsplit_package ' );
743
770
744
771
$ this ->statusOutput ->markStepDone ('generating_subsplit_configuration ' );
0 commit comments