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
    }
}

Disclaimer: Viewing non-Euro pricing

You are currently viewing prices in a non-Euro currency. Please be advised that these prices are estimates, based on data by Open Exchange Rates.

While we offer this currency converter hoping our users find it convenient, all purchases are made in Euro, and the final amount charged can vary depending on payment provider, day, time of day and a number of other factors outside of modmore's control. There are no guarantees on accuracy and neither modmore nor Open Exchange Rates can be held liable for errors.

×