Coding Style
Try to apply PSR-1 and PSR-2 as much as possible in new code.
Settings need to be in namespace.snake_case_format, while element properties should be in &camelCaseFormat=`foo`. Database table fields need to be snake_case, and lexicon entries also need to be namespace.snake_case. Array keys need to be $array['snake_case'].
Code style example
Refer to the Official PHP FIG Site for specific information. Below is an example of how code should look. Some items may not apply as we're not actively using namespaces (yet?!) and the likes. PSR-1 is here.
<?php
namespace Vendor\Package;
use FooInterface;
use BarClass as Bar;
use OtherVendor\OtherPackage\BazClass;
class Foo extends Bar implements FooInterface
{
public $someClassMember = 'foo';
public $anArray = array(
'array_key_1' => 'foo',
'array_key_2' => 'bar',
);
public function sampleFunction($a, $b = null)
{
$modxConfig = $modx->getOption('namespace.setting_key_here', null, 'default');
if ($a === $b) {
bar();
} elseif ($a > $b) {
$foo->bar($arg1);
} else {
BazClass::bar($arg2, $arg3);
}
}
final public static function bar()
{
// method body
}
}