# Conventions — rank24.pl ## PHP Naming | Element | Convention | Example | |---------|-----------|---------| | Class files | `class.ClassName.php` | `class.GoogleRank.php` | | Class names | PascalCase | `GoogleScraper`, `FileCache` | | Namespaces | lowercase | `controls\`, `factory\`, `view\` | | Public methods | camelCase | `SaveData()`, `getpagedata()` | | Private properties | underscore + camelCase | `$_table`, `$_proxy`, `$_header` | | Local variables | snake_case | `$db_edit_table`, `$last_id` | | Config keys | snake_case | `$config['db']['host']` | ## File Naming - Class files: `class.ClassName.php` in `autoload/` subdirectory matching namespace - Templates: lowercase with hyphens — `main-layout.php`, `site-edit.php` - Entry points: lowercase — `index.php`, `ajax.php`, `cron.php` - Directories: lowercase — `autoload/`, `templates/`, `libraries/` ## Code Style - **Indentation**: 2 spaces - **Braces**: K&R — opening brace on same line for control structures; new line for methods - **Spacing**: spaces around `->`, `=`, `=>` operators; spaces inside `( )` for function calls - **Arrays**: mix of long `array()` in config, short `[]` in Medoo queries - **Short PHP tags**: templates use `varName` - Tpl templates receive variables as assigned properties, accessed in template scope - HTML helper components in `templates/html/` — generated via `\Html::form_text()`, `\Html::select()`, etc. - All UI strings use Polish language ## Language - All user-facing text, comments, variable names, and commit messages are in **Polish**