Qual: Optimize PHP Code sniffer rules

This commit is contained in:
Laurent Destailleur 2011-08-28 17:40:51 +00:00
parent f7416d86cd
commit 69892eccf8
4 changed files with 28 additions and 21 deletions

View File

@ -35,7 +35,7 @@
* \brief Put here description of your class
* \remarks Put here some comments
*/
class Skeleton_class // extends CommonObject
class Skeleton_Class // extends CommonObject
{
var $db; //!< To store db handler
var $error; //!< To return error code (or message)
@ -51,9 +51,10 @@ class Skeleton_class // extends CommonObject
/**
* Constructor
* @param DB Database handler
*
* @param DoliDb $DB Database handler
*/
function Skeleton_class($DB)
function Skeleton_Class($DB)
{
$this->db = $DB;
return 1;
@ -62,9 +63,10 @@ class Skeleton_class // extends CommonObject
/**
* Create object into database
* @param user User that create
* @param notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
*
* @param User $user User that create
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
function create($user, $notrigger=0)
{
@ -135,8 +137,9 @@ class Skeleton_class // extends CommonObject
/**
* Load object in memory from database
* @param id id object
* @return int <0 if KO, >0 if OK
*
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
function fetch($id)
{
@ -177,9 +180,10 @@ class Skeleton_class // extends CommonObject
/**
* Update object into database
* @param user User that modify
* @param notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*
* @param User $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
{
@ -244,9 +248,10 @@ class Skeleton_class // extends CommonObject
/**
* Delete object in database
* @param user User that delete
* @param notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*
* @param User $user User that delete
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger=0)
{
@ -300,8 +305,9 @@ class Skeleton_class // extends CommonObject
/**
* Load an object from its id and create a new one in database
* @param fromid Id of object to clone
* @return int New id of clone
*
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
function createFromClone($fromid)
{
@ -309,7 +315,7 @@ class Skeleton_class // extends CommonObject
$error=0;
$object=new Skeleton_class($this->db);
$object=new Skeleton_Class($this->db);
$this->db->begin();
@ -354,7 +360,9 @@ class Skeleton_class // extends CommonObject
/**
* Initialisz object with example values
* Id must be 0 if object instance is a specimen.
* Id must be 0 if object instance is a specimen
*
* @return none
*/
function initAsSpecimen()
{

View File

@ -70,7 +70,7 @@ if ($user->societe_id > 0)
if ($_GET["action"] == 'add' || $_POST["action"] == 'add')
{
$myobject=new Skeleton_class($db);
$myobject=new Skeleton_Class($db);
$myobject->prop1=$_POST["field1"];
$myobject->prop2=$_POST["field2"];
$result=$myobject->create($user);

View File

@ -71,7 +71,7 @@ $db->begin();
// Examples for manipulating class skeleton_class
require_once(DOL_DOCUMENT_ROOT."/../dev/skeletons/skeleton_class.class.php");
$myobject=new Skeleton_class($db);
$myobject=new Skeleton_Class($db);
// Example for inserting creating object in database
/*

View File

@ -85,7 +85,6 @@ if ($argv[2] != 'all')
}
}
// Examples for manipulating class skeleton_class
require_once(DOL_DOCUMENT_ROOT."/../dev/translation/langAutoParser.class.php");
$langParser = new langAutoParser($argv[2],$argv[1],$dir,$file);