Qual: Optimize PHP Code sniffer rules
This commit is contained in:
parent
f7416d86cd
commit
69892eccf8
@ -35,7 +35,7 @@
|
|||||||
* \brief Put here description of your class
|
* \brief Put here description of your class
|
||||||
* \remarks Put here some comments
|
* \remarks Put here some comments
|
||||||
*/
|
*/
|
||||||
class Skeleton_class // extends CommonObject
|
class Skeleton_Class // extends CommonObject
|
||||||
{
|
{
|
||||||
var $db; //!< To store db handler
|
var $db; //!< To store db handler
|
||||||
var $error; //!< To return error code (or message)
|
var $error; //!< To return error code (or message)
|
||||||
@ -51,9 +51,10 @@ class Skeleton_class // extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param DB Database handler
|
*
|
||||||
|
* @param DoliDb $DB Database handler
|
||||||
*/
|
*/
|
||||||
function Skeleton_class($DB)
|
function Skeleton_Class($DB)
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
return 1;
|
return 1;
|
||||||
@ -62,8 +63,9 @@ class Skeleton_class // extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create object into database
|
* Create object into database
|
||||||
* @param user User that create
|
*
|
||||||
* @param notrigger 0=launch triggers after, 1=disable triggers
|
* @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
|
* @return int <0 if KO, Id of created object if OK
|
||||||
*/
|
*/
|
||||||
function create($user, $notrigger=0)
|
function create($user, $notrigger=0)
|
||||||
@ -135,7 +137,8 @@ class Skeleton_class // extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load object in memory from database
|
* Load object in memory from database
|
||||||
* @param id id object
|
*
|
||||||
|
* @param int $id Id object
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id)
|
function fetch($id)
|
||||||
@ -177,8 +180,9 @@ class Skeleton_class // extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update object into database
|
* Update object into database
|
||||||
* @param user User that modify
|
*
|
||||||
* @param notrigger 0=launch triggers after, 1=disable triggers
|
* @param User $user User that modify
|
||||||
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user=0, $notrigger=0)
|
function update($user=0, $notrigger=0)
|
||||||
@ -244,8 +248,9 @@ class Skeleton_class // extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete object in database
|
* Delete object in database
|
||||||
* @param user User that delete
|
*
|
||||||
* @param notrigger 0=launch triggers after, 1=disable triggers
|
* @param User $user User that delete
|
||||||
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user, $notrigger=0)
|
function delete($user, $notrigger=0)
|
||||||
@ -300,7 +305,8 @@ class Skeleton_class // extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
* @param fromid Id of object to clone
|
*
|
||||||
|
* @param int $fromid Id of object to clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
function createFromClone($fromid)
|
function createFromClone($fromid)
|
||||||
@ -309,7 +315,7 @@ class Skeleton_class // extends CommonObject
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object=new Skeleton_class($this->db);
|
$object=new Skeleton_Class($this->db);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
@ -354,7 +360,9 @@ class Skeleton_class // extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialisz object with example values
|
* 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()
|
function initAsSpecimen()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -70,7 +70,7 @@ if ($user->societe_id > 0)
|
|||||||
|
|
||||||
if ($_GET["action"] == 'add' || $_POST["action"] == 'add')
|
if ($_GET["action"] == 'add' || $_POST["action"] == 'add')
|
||||||
{
|
{
|
||||||
$myobject=new Skeleton_class($db);
|
$myobject=new Skeleton_Class($db);
|
||||||
$myobject->prop1=$_POST["field1"];
|
$myobject->prop1=$_POST["field1"];
|
||||||
$myobject->prop2=$_POST["field2"];
|
$myobject->prop2=$_POST["field2"];
|
||||||
$result=$myobject->create($user);
|
$result=$myobject->create($user);
|
||||||
|
|||||||
@ -71,7 +71,7 @@ $db->begin();
|
|||||||
|
|
||||||
// Examples for manipulating class skeleton_class
|
// Examples for manipulating class skeleton_class
|
||||||
require_once(DOL_DOCUMENT_ROOT."/../dev/skeletons/skeleton_class.class.php");
|
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
|
// Example for inserting creating object in database
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -85,7 +85,6 @@ if ($argv[2] != 'all')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Examples for manipulating class skeleton_class
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/../dev/translation/langAutoParser.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/../dev/translation/langAutoParser.class.php");
|
||||||
|
|
||||||
$langParser = new langAutoParser($argv[2],$argv[1],$dir,$file);
|
$langParser = new langAutoParser($argv[2],$argv[1],$dir,$file);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user