29 lines
1.2 KiB
Markdown
29 lines
1.2 KiB
Markdown
# Code Style and Conventions
|
|
|
|
## PHP Style
|
|
- Spaces around brackets in array access: `$_SESSION[ 'key' ]`, `$array[ 'field' ]`
|
|
- Spaces inside parentheses: `function( $param )`, `if ( condition )`
|
|
- Opening braces on new line for functions/classes
|
|
- Opening braces on same line for control structures (mixed - some on new line)
|
|
- No type hints on most functions (legacy codebase)
|
|
- No docblocks on most methods
|
|
- camelCase for methods, PascalCase for classes
|
|
- File naming: `class.ClassName.php` for autoloaded classes, regular names for others
|
|
|
|
## Naming Conventions
|
|
- Controllers: `{Entity}Controller.php` (e.g., `ShopProductController.php`)
|
|
- Repositories: `{Entity}Repository.php` (e.g., `ProductRepository.php`)
|
|
- Views: `{Entity}.php` in `Views/` directory
|
|
- Templates: kebab-case directories (e.g., `shop-product/`, `shop-basket/`)
|
|
- Admin templates: organized by feature in `admin/templates/`
|
|
|
|
## Database
|
|
- RedBeanPHP ORM with `\R::` facade
|
|
- Medoo for complex queries via `$mdb`
|
|
- Tables use snake_case naming
|
|
|
|
## Frontend
|
|
- SCSS compiled to CSS in admin (`style.scss` -> `style.css`)
|
|
- Vanilla JavaScript (no build system, no npm/node)
|
|
- jQuery likely used in admin panel
|