Elefant uses the following conventions for all core libraries and apps:
Elefant code should be indented with tabs, not spaces. This way, individual developers can adjust their editor settings to the amount of indentation they prefer.
Elefant code should use trailing braces instead of putting them on their own lines. Put a space before open braces and between operators, for example:
<?php
function foo_bar ($foo = false) {
if (! $foo) {
// etc.
}
}
Use JavaDoc-style commenting for describing classes and methods, and use double-slashes for inline comments.
Comments describing classes, methods, and properties should use the Markdown format for formatting text.
For reference, here is a complete example class in the recommended style:
<?php
namespace myapp;
/**
* Class description here.
*/
class FooBar {
/**
* A property.
*/
public $name = 'Default value';
/**
* A method.
*/
public function set_name ($new_name) {
$this->name = $new_name;
}
}
Note: PHP closing tags should not be included and files should end with a blank line.
Back: Contributing to Elefant