Coding Standards

The Coding Standards apply to code that is part of the ea-Geier project. They aim to keep code consistent to be easily readable and maintainable. (PC009)

Indentation and Brackating

Braces and indents are matched the K&R style. The opening brace is on the same line as the control statement. Statements within the braces are indented (1 tab = 4 spaces). The closing brace is on the same indentation level as the control statement on a line of its own.

function dummy() {
    while (x == y) {
    if (x < 0) {
    } else {

Line Lengths

Lines are at maximum approximately 75 to 85 characters long for better code readability. However, structures like long strings shall not be separated arbitrary.

Control Structures

Control statements have one space between the control keyword and opening parenthesis, to distinguish them from function calls.

if (($x < $y) || ($y == 1)) {
} elseif (($x > $y) &amp;&amp; ($y == 1)) {
} else {
switch ($x) {
    case 1:
    case 2:


Functions are called with no spaces between the function name, the opening parenthesis, and the first parameter. Spaces separate commas from the following parameter. There are no spaces between the last parameter, the closing parenthesis, and the semicolon.

$var = dummy($x, $y, true);

Each function returns false if an error occurred. In any other case it returns true or some other meaningful value.

PHP Code Tags

Always use to delimit PHP code, not the shorthand. This the most portable way to include PHP code on differing operating systems and setups.


C style comments (/* */) and standard C++ comments (//) are valid.

Complete inline documentation comment blocks (docblocks) must be provided for the phpDocumentor tool.

Non-documentation comments explain non-standard solutions.

Naming Conventions

Variables, functions, classes, constants, etc. shall have descriptive names.

Names of variables and functions begin with an lowercase letter. Class names begin with an uppercase letter. Each letter of a name that starts with a new “word” is capitalized. Constants are all-uppercase, with underscores to separate the words.

Private class members (meaning class members that are intended to be used only from within the same class in which they are declared) are preceded by a single underscore.

To identify (and distinguish) global variables, functions, classes, constants, etc. created by the ea-Geier, they are preceded by the letters ea.

Error Handling

The code shall not produce any warnings or errors when PHP’s error reporting level is set to E_ALL in PHP4 and E_ALL | E_STRICT in PHP5.

Directory Structure

All files have to be on an appropriate place in the directory structure.