Sample Files
(Development)
Sample File (including Docblock Comment standards http://pear.php.net/manual/en/standards.sample.php) from the PEAR Coding Standards. phpDocumentor Sample File. http://manual.phpdoc.org/HTMLframesConverter/default/phpDocumentor/tutorial sample2.pkg.html
Other labels:
coding, developer
|
Naming Conventions
(Development)
Classes Classes should be given descriptive names. Avoid using abbreviations where possible. Class names should always begin with an uppercase letter. The Mambo class hierarchy is also reflected in the class name, each level of the hierarchy separated ...
Other labels:
coding, developer
|
Example URL's
(Development)
Use "example.com", "example.org" and "example.net" for all example URLs and email addresses, per RFC 2606.\\ Next: Naming Conventions
Other labels:
coding, developer
|
Header Comment Blocks
(Development)
All source code files in the Mambo repository shall contain a "pagelevel" docblock at the top of each file and a "classlevel" docblock immediately above each class. Below are examples of such docblocks. <?php/ @package Mambo @author Mambo Foundation Inc see ...
Other labels:
coding, developer
|
PHP Code Tags
(Development)
Always use <?php ?> to delimit PHP code, not the <? ?> shorthand. This is required for Mambo compliance and is also the most portable way to include PHP code on differing operating systems and setups. Note that the final ?> should be omitted from all code filesmodules, includes ...
Other labels:
coding, developer
|
Including Code
(Development)
Anywhere you are unconditionally including a class file, use requireonce. Anywhere you are conditionally including a class file (for example, factory methods), use includeonce. Either of these will ensure that class files are included only once. They share the same file list ...
Other labels:
coding, developer
|
Comments
(Development)
Complete inline documentation comment blocks (docblocks) must be provided. Inline documentation for classes should follow the phpDocumentor convention. More information about phpDocumentor can be found here: http://phpdoc.org Nondocumentation comments are strongly encouraged. A general rule ...
Other labels:
coding, developer
|
Function Definitions
(Development)
Function declarations follow the "one true brace" convention: <?php function fooFunction( $arg1, $arg2 = '' ){ if (condition) return $val; } ?> Arguments with default values go at the end of the argument list. Always attempt to return a meaningful value from a function if one ...
Other labels:
coding, developer
|
Function Calls
(Development)
Functions should be called with no spaces between the function name, the opening parenthesis, and the first parameter; spaces between commas and each parameter, and no space between the last parameter, the closing parenthesis, and the semicolon. Here's an example: <?php $var = foo( $bar ...
Other labels:
coding, developer
|
Control Structures
(Development)
include if, for, while, switch, etc. Use of the "elseif" construct is permitted but highly discouraged in favour of the "else if" combination. Here is an example if statement, since it is the most complicated of them: <?php if ((condition1) (condition2)) elseif ((condition3) && (condition4)) else { if (condition5) defaultaction ...
Other labels:
coding, developer
|