@@ -30,27 +30,31 @@ class StaticDataDefinition extends Definition implements Writable
3030 * @param string|null $fieldName When set, overrides class name derivation (used for nested definitions).
3131 * @param string $classPrefix Prepended to the short class name to avoid collisions in deep nesting.
3232 * @param bool $singularize When true, singularizes the field name for the class name (used for list fields).
33+ * @param string $game 'lol' or 'tft' — determines the Assets sub-namespace.
3334 */
3435 public function __construct (
3536 private readonly CDragonEndpoint $ endpoint ,
3637 private readonly ?string $ parentSlug = null ,
3738 private readonly ?string $ fieldName = null ,
3839 private readonly string $ classPrefix = '' ,
3940 private readonly bool $ singularize = false ,
41+ private readonly string $ game = 'lol ' ,
4042 ) {}
4143
4244 public function namespace (): string
4345 {
4446 $ slug = $ this ->parentSlug ?? $ this ->endpoint ->slug ;
47+ $ stem = StaticGameClientDefinition::resolveSlugStem ($ slug , $ this ->game );
4548
46- return $ this ->resolveNamespace ('CDragon \\' .Str:: studly ( $ slug ) .'\\Objects ' );
49+ return $ this ->resolveNamespace ('Assets \\' .ucfirst ( $ this -> game ). '\\' . $ stem .'\\Objects ' );
4750 }
4851
4952 public function directory (): string
5053 {
5154 $ slug = $ this ->parentSlug ?? $ this ->endpoint ->slug ;
55+ $ stem = StaticGameClientDefinition::resolveSlugStem ($ slug , $ this ->game );
5256
53- return $ this ->resolvePath ('CDragon / ' .Str:: studly ( $ slug ) .'/Objects ' );
57+ return $ this ->resolvePath ('Assets / ' .ucfirst ( $ this -> game ). ' / ' . $ stem .'/Objects ' );
5458 }
5559
5660 public function imports (): array
@@ -159,7 +163,7 @@ public function nestedDefinitions(): array
159163 fields: $ field ->subFields ,
160164 );
161165
162- $ def = new StaticDataDefinition ($ subEndpoint , $ parentSlug , $ field ->name , $ this ->childClassPrefix (), $ singularize );
166+ $ def = new StaticDataDefinition ($ subEndpoint , $ parentSlug , $ field ->name , $ this ->childClassPrefix (), $ singularize, $ this -> game );
163167 $ nested [] = $ def ;
164168
165169 foreach ($ def ->nestedDefinitions () as $ deepNested ) {
@@ -180,7 +184,9 @@ private function shortClassName(): string
180184 return $ this ->classPrefix .$ base .'Data ' ;
181185 }
182186
183- return Str::studly (Str::singular ($ this ->endpoint ->slug )).'Data ' ;
187+ $ stem = StaticGameClientDefinition::resolveSlugStem ($ this ->endpoint ->slug , $ this ->game );
188+
189+ return Str::singular ($ stem ).'Data ' ;
184190 }
185191
186192 /**
@@ -227,7 +233,8 @@ private function shouldGenerateNested(CDragonField $field, bool $singularize): b
227233 private function nestedFqcn (string $ fieldName , bool $ singularize ): string
228234 {
229235 $ slug = $ this ->parentSlug ?? $ this ->endpoint ->slug ;
230- $ ns = $ this ->resolveNamespace ('CDragon \\' .Str::studly ($ slug ).'\\Objects ' );
236+ $ stem = StaticGameClientDefinition::resolveSlugStem ($ slug , $ this ->game );
237+ $ ns = $ this ->resolveNamespace ('Assets \\' .ucfirst ($ this ->game ).'\\' .$ stem .'\\Objects ' );
231238 $ base = $ singularize ? Str::studly (Str::singular ($ fieldName )) : Str::studly ($ fieldName );
232239 $ cn = $ this ->childClassPrefix ().$ base .'Data ' ;
233240
0 commit comments