Files
rspade_system/app/RSpade/CodeQuality/Support/InitializationSuggestions.php
root 84ca3dfe42 Fix code quality violations and rename select input components
Move small tasks from wishlist to todo, update npm packages
Replace #[Auth] attributes with manual auth checks and code quality rule
Remove on_jqhtml_ready lifecycle method from framework
Complete ACL system with 100-based role indexing and /dev/acl tester
WIP: ACL system implementation with debug instrumentation
Convert rsx:check JS linting to RPC socket server
Clean up docs and fix $id→$sid in man pages, remove SSR/FPC feature
Reorganize wishlists: priority order, mark sublayouts complete, add email
Update model_fetch docs: mark MVP complete, fix enum docs, reorganize
Comprehensive documentation overhaul: clarity, compression, and critical rules
Convert Contacts/Projects CRUD to Model.fetch() and add fetch_or_null()
Add JS ORM relationship lazy-loading and fetch array handling
Add JS ORM relationship fetching and CRUD documentation
Fix ORM hydration and add IDE resolution for Base_* model stubs
Rename Json_Tree_Component to JS_Tree_Debug_Component and move to framework
Enhance JS ORM infrastructure and add Json_Tree class name badges

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 21:39:43 +00:00

67 lines
2.9 KiB
PHP
Executable File

<?php
namespace App\RSpade\CodeQuality\Support;
/**
* Provides shared initialization method suggestions based on code location
*/
class InitializationSuggestions
{
/**
* Get appropriate lifecycle method suggestions based on file path
*
* @param string $file_path The path to the JavaScript file
* @return string Formatted suggestion text
*/
public static function get_suggestion(string $file_path): string
{
$is_framework_code = str_contains($file_path, '/app/RSpade/');
$is_user_code = str_contains($file_path, '/rsx/');
if ($is_framework_code) {
return "Use framework lifecycle methods in ES6 classes:\n" .
" - _on_framework_core_define() - For core framework metadata\n" .
" - _on_framework_core_init() - For core framework initialization\n" .
" - _on_framework_module_define() - For framework module metadata\n" .
" - _on_framework_module_init() - For framework module initialization\n" .
"These methods are automatically called by the RSpade JS runtime.";
} elseif ($is_user_code) {
return "Use ES6 class lifecycle methods:\n" .
" - on_app_ready() - For final initialization (most common)\n" .
" - on_app_init() - For app-level setup\n" .
" - on_modules_init() - For module initialization\n" .
" - on_modules_define() - For module metadata registration\n" .
"These methods are automatically called by the RSpade JS runtime.";
} else {
return "Create an ES6 class with static lifecycle methods. These will be called automatically by the RSpade JS runtime.";
}
}
/**
* Get framework-only method suggestions
*
* @return string Formatted suggestion text for framework methods
*/
public static function get_framework_suggestion(): string
{
return "Use framework lifecycle methods instead:\n" .
" - _on_framework_core_define() - For core framework metadata\n" .
" - _on_framework_core_init() - For core framework initialization\n" .
" - _on_framework_module_define() - For framework module metadata\n" .
" - _on_framework_module_init() - For framework module initialization";
}
/**
* Get user-only method suggestions
*
* @return string Formatted suggestion text for user methods
*/
public static function get_user_suggestion(): string
{
return "Use user code lifecycle methods instead:\n" .
" - on_app_ready() - For final initialization (most common)\n" .
" - on_app_init() - For app-level setup\n" .
" - on_modules_init() - For module initialization\n" .
" - on_modules_define() - For module metadata registration";
}
}