Staff culture

Z Freenetis Wiki
Verze z 7. 6. 2014, 14:46, kterou vytvořil Sivosha (diskuse | příspěvky)
(rozdíl) ← Starší verze | zobrazit aktuální verzi (rozdíl) | Novější verze → (rozdíl)
Přejít na: navigace, hledání


Developers FreenetISu is recommended to follow the defined rules to increase readability and consistency of source codes.

Each source file should start with the following code: <?php defined('SYSPATH') or die('No direct script access.');

/*
 * This file is part of open source system FreenetIS
 * and it is released under GPLv3 licence.
 *
 * More info about licence can be found:
 * http://www.gnu.org/licenses/gpl-3.0.html
 *
 * More info about project can be found:
 * http://www.freenetis.org/
 *
 */

Offsetting

Offsetting the source text is done using the Tab key. unless otherwise stated, it is assumed now that the offset.

Wrap

Line codes controllers, models and helpers should not exceed 80 characters. For lines exceeding this length wraps source code according to the following rules:

'Wrap boxes'

array

(
    'a', 'b', c', 'd', 'e',
    'f', 'g'
);
array
(
    'a'   => val1,
    'b'   => val2
);

Wrap function arguments

Wrap the arguments in definitions and declarations.

Used to offset internal arguments about 2 tabs

funkce(arg1, arg2,
        arg3, arg4
);

or

funkce(
        arg1, arg2,
        arg3, arg4
);

Chained method objects

This wrap is suitable if a line of code does not exceed 80 characters.

It is used to offset the 2 tabs

$object->method1()
        ->method2();

Compound conditions

if (conditionA && (
        conditionB ||
        conditionC
   ))
{
    ...
}