CORE-POS Coding Standards


as of: March 30, 2015
The latest documentation can be found on the Project Wiki. The information below may be out of date.

PHP Standards

CORE generally follows the style guidelines for the PHP Framework Interop Group. New code should follow the PSR-1 coding standard and the PSR-2 style guide. There are two exceptions of note:
  1. CORE does use class autoloading, but does not currently use namespaces or underscores to define directory paths. File names should still match class names and be case-sensitive - e.g., class Foo should be defined in a file named Foo.php.
  2. PSR-1 says Files SHOULD either declare symbols (classes, functions, constants, etc.) or cause side-effects (e.g. generate output, change .ini settings, etc.) but SHOULD NOT do both. CORE files should not cause side effects at all when include()ed; side effects should only occur when files are directly executed. This aids in class autodiscovery. Typically one of these constructs used:
    if (dirname(__FILE__) == dirname($_SERVER['PHP_SELF'])) {
        // means file is being executed
        // side effects code goes here
    }
    
    // OR EQUIVALENTLY
    
    FannieDispatch::conditionalExec();
        

SQL Standards

  1. Naming Things:
  2. Writing Queries: