44
55namespace RZ \Roadiz \Typescript \Declaration \Generators ;
66
7+ use RZ \Roadiz \Contracts \NodeType \NodeTypeClassLocatorInterface ;
78use RZ \Roadiz \Contracts \NodeType \NodeTypeFieldInterface ;
89use RZ \Roadiz \Contracts \NodeType \NodeTypeInterface ;
910use RZ \Roadiz \Contracts \NodeType \SerializableInterface ;
@@ -19,6 +20,7 @@ final class NodeTypeGenerator
1920 public function __construct (
2021 private readonly NodeTypeInterface $ nodeType ,
2122 private readonly DeclarationGeneratorFactory $ generatorFactory ,
23+ private readonly NodeTypeClassLocatorInterface $ nodeTypeClassLocator ,
2224 ) {
2325 $ this ->fieldGenerators = [];
2426
@@ -51,18 +53,18 @@ public function getContents(): string
5153 ]);
5254 }
5355
54- protected function getInterfaceBody (): string
56+ private function getInterfaceBody (): string
5557 {
5658 $ lines = [
57- 'export interface ' .$ this ->nodeType ->getSourceEntityClassName ().' extends RoadizNodesSources { ' ,
59+ 'export interface ' .$ this ->nodeTypeClassLocator ->getSourceEntityClassName ($ this -> nodeType ).' extends RoadizNodesSources { ' ,
5860 $ this ->getFieldsContents (),
5961 '} ' ,
6062 ];
6163
6264 return implode (PHP_EOL , $ lines );
6365 }
6466
65- protected function getIntroduction (): string
67+ private function getIntroduction (): string
6668 {
6769 $ lines = [
6870 '' ,
@@ -80,7 +82,7 @@ protected function getIntroduction(): string
8082 return implode (PHP_EOL , array_map (fn (string $ line ) => '// ' .$ line , $ lines ));
8183 }
8284
83- protected function getFieldsContents (): string
85+ private function getFieldsContents (): string
8486 {
8587 return implode (PHP_EOL , array_map (fn (AbstractFieldGenerator $ abstractFieldGenerator ) => $ abstractFieldGenerator ->getContents (), $ this ->fieldGenerators ));
8688 }
0 commit comments