Wygenerowano przez równoległą analizę czterech agentów: stack, architektura, konwencje, integracje, testy, baza danych oraz wykryte problemy i dług techniczny. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.9 KiB
2.9 KiB
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.phpinautoload/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
<?and<?=(not<?php) - No type hints: no PHP type declarations used anywhere
Error Handling
- Global error suppression in
index.php:error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED); - User alerts via
\S::alert('message')— stored in session, displayed on next render - Very limited try/catch; exceptions only in OPD wrapper (
opd.class.php) - File/curl errors frequently suppressed with
@operator
Database Conventions
- New code: use Medoo (
$mdb), array-based query syntax - Legacy code: use OPD (
$db), PDOprepare()+execute() - Table names:
pro_prefix (e.g.,pro_rr_clients,pro_proxy_servers) - All factory methods access DB via
global $mdb;
Configuration Access
- All config in
config.phpas$config['section']['key']array - Classes access via
global $config; - No
.envfiles, no constants for settings (onlyOPD_DIR,OPD_VERSION)
Comments & Docs
- Comments are sparse and in Polish
- No docblocks on most classes/methods (exception:
RestClient3.php) - Inline comments explain "why" only — rare but present
Global State
Classes depend on globals declared at bootstrap:
global $db, $mdb, $lang, $sys, $user, $cache, $config, $settings;
No dependency injection. No service container.
Template Conventions
- Savant3 templates receive variables as
$this->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