Skip to content
No description, website, or topics provided.
PHP JavaScript CSS HTML Python Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
api
bogo
discountsvoucher
mostcoupon
portal
.gitignore
LICENSE
README.md
composer.phar

README.md

MostCoupon developer guideline

Environments, domains, Git, Github

Environment Deploy strategy Git banch URL
Staging Push hook on Repo master Click here
Production Manual production mostcoupon.com
Jira Agile Click here
PHPPgAdmin Click here
PHPMyAdmin Click here
Jenkins Click here

Coding conventions

Programmers contributing to this project should follow a few simple code conventions to increase code readability and maintainability.

Indentation

In Eclipse go to Window->Preferences->PHP->Code Style->Formatter and alter the properties as follows:

  • Tab policy: Spaces

  • Indentation size: 4

  • Tab size: 4

  • Default indentation for wrapped lines: 1

  • Default indentation for array initializers: 1

Control Structures

Always use curly brackets in control structures, even if they are not needed. They increase the readability of the code, and they give you fewer logical errors.

if ((expr_1) || (expr_2)) {
    // action_1;
} elseif (!(expr_3) && (expr_4)) {
    // action_2;
} else {
    // default_action;
}

Spaces

Always use spaces before and after operators.

   $var1 = ($var2 + $var3) / 6;
   $arr1 = array('key' => 'value');

Visibility

Use PHP5`s private and protected keywords (public, protected, private). Additionally, protected method or variable names start with a single underscore ("_").

class Test {
   private $_foo;

   protected function _bar() {
       /*...*/
   }

   public function baz(Test $other) {
       /*...*/
   }
}

Naming convention

Functions

Write all functions in camelBack:

   public function longFunctionName() {
   	/*...*/
   }

Classes

Class names should be written in CamelCase, for example:

   class ExampleClass {
   	/*...*/
   }

Variables

Variable names should be as descriptive as possible and should be written in camelBack in case of multiple words.

   $user = 'John';
   $listOfUsers = array('John', 'Hans', 'Arne');

This code convetions are inspired by the CakePHP coding conventions.

Documentation and comments

All comments and documentation should be written in English, and should in a clear way describe the commented block of code.

Each method should be documented, at least with a short phrase. Documentation should use the PhpDoc syntax:

   /**
    * Foo function
	*/
   public function foo() {
   	/*...*/
   }

Dependencies / libraries

Third party dependencies are managed through Composer. To add a dependency find the package on Packagist and add it to api/app/composer.json or frontend/app/composer.json.

You can’t perform that action at this time.