-
Notifications
You must be signed in to change notification settings - Fork 123
Programming standards
The old code base is a mess of random code with no standards future additions must follow these standards as well as re-writing old code must follow these. (Eventually the whole code base will follow these standards)
Must be descriptive of what the variable is for, be all lower case, start with a lower case letter and if it contains multiple words each word must be separated by an underscore
Good Examples:
- $auction_data
- $feedback_count
- $is_buy_it_now
Bad Examples:
- $count (count of what?)
- $VALUE (not lower case, also value of what?)
- $_name (does not start with lower case letter)
Must be descriptive of what the function is for, be in camelCase, start with a lower case letter and only have one distinct function (only do one thing)
Function parameters should be named as such that glancing at the first line of the function should tell you exactly what the function does
function getUserData($username)
Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting.
Capitialise all SQL keywords (SELECT, FROM, VALUES, AS etc.) and leave everything else in the relevant case.
When the sole purpose of a query is to count the results use sql COUNT(id) instead of php numrows()
Strings should be quoted with single quotes, never double quotes
For more info review https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md