diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index bbe101112d0..fd00d7e68e8 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -238,9 +238,9 @@ - + diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 660886c835d..85be894bae0 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -25,9 +25,18 @@ include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class */ class Dolistore { - // params - public $start; // beginning of pagination - public $end; // end of pagination + /** + * beginning of pagination + * @var int + */ + + public $start; + /** + * end of pagination + * @var int + */ + public $end; + public $per_page; // pagination: display per page public $categorie; // the current categorie public $search; // the search keywords @@ -282,16 +291,33 @@ class Dolistore return $html; } + /** + * get previous link + * + * @param string $text symbol previous + * @return string html previous link + */ function get_previous_link($text = '<<') { return ''.$text.''; } + /** + * get next link + * + * @param string $text symbol next + * @return string html next link + */ function get_next_link($text = '>>') { return ''.$text.''; } + /** + * get previous url + * + * @return string previous url + */ function get_previous_url() { $param_array = array(); @@ -309,6 +335,11 @@ class Dolistore return $this->url."&".$param; } + /** + * get next url + * + * @return string next url + */ function get_next_url() { $param_array = array(); @@ -326,6 +357,13 @@ class Dolistore return $this->url."&".$param; } + /** + * version compare + * + * @param string $v1 version 1 + * @param string $v2 version 2 + * @return int result of compare + */ function version_compare($v1, $v2) { $v1 = explode('.', $v1); @@ -355,4 +393,3 @@ class Dolistore return $ret; } } - diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index b250bf28a87..9205d49deae 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -52,6 +52,12 @@ if (!$mode) $mode='config'; // used in library escpos maybe useful if php doesn't support gzdecode if (!function_exists('gzdecode')) { + /** + * Gzdecode + * + * @param string $data data to deflate + * @return string data deflated + */ function gzdecode($data) { return gzinflate(substr($data,10,-8)); @@ -450,4 +456,3 @@ if ($mode == 'template' && $user->admin) // End of page llxFooter(); $db->close(); - diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8a06a0d7764..4d0b866cf90 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -607,19 +607,19 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu } -/** - * Return a prefix to use for this Dolibarr instance, for session/cookie names or email id. - * This prefix is valid in a web context only and is unique for instance and avoid conflict - * between multi-instances, even when having two instances with one root dir or two instances - * in virtual servers. - * - * @param string $mode '' (prefix for session name) or 'email' (prefix for email id) - * @return string A calculated prefix - */ if (! function_exists('dol_getprefix')) { - function dol_getprefix($mode='') - { + /** + * Return a prefix to use for this Dolibarr instance, for session/cookie names or email id. + * This prefix is valid in a web context only and is unique for instance and avoid conflict + * between multi-instances, even when having two instances with one root dir or two instances + * in virtual servers. + * + * @param string $mode '' (prefix for session name) or 'email' (prefix for email id) + * @return string A calculated prefix + */ + function dol_getprefix($mode='') + { global $conf; // If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 4553fec4641..783e6a0cb35 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1167,6 +1167,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m return $numFinal; } +/** + * Get string between + * + * @param string $string String to test + * @param int $start Value for start + * @param int $end Value for end + * @return string Return part of string + */ function get_string_between($string, $start, $end) { $string = " ".$string; diff --git a/htdocs/dav/dav.class.php b/htdocs/dav/dav.class.php index 9e5121112d0..15152529418 100644 --- a/htdocs/dav/dav.class.php +++ b/htdocs/dav/dav.class.php @@ -34,11 +34,18 @@ class CdavLib private $langs; + /** + * Constructor + * + * @param User $user user + * @param DoliDB $db Database handler + * @param Translation $langs translation + */ function __construct($user, $db, $langs) { - $this->user = $user; - $this->db = $db; - $this->langs = $langs; + $this->user = $user; + $this->db = $db; + $this->langs = $langs; } /** diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 23282586d22..21a38626fb0 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -657,6 +657,9 @@ class PropalmergepdfproductLine var $tms=''; var $import_key; + /** + * Constructor + */ function __construct() { return 1; diff --git a/htdocs/product/inventory/lib/inventory.lib.php b/htdocs/product/inventory/lib/inventory.lib.php index aa8c9c9677d..d6230e4f3e7 100644 --- a/htdocs/product/inventory/lib/inventory.lib.php +++ b/htdocs/product/inventory/lib/inventory.lib.php @@ -25,7 +25,7 @@ /** * Define head array for tabs of inventory tools setup pages * - * @return Array of head + * @return array Array of head */ function inventoryAdminPrepareHead() { @@ -40,7 +40,7 @@ function inventoryAdminPrepareHead() $head[$h][1] = $langs->trans("Parameters"); $head[$h][2] = 'settings'; $h++; - + // Show more tabs from modules // Entries must be declared in modules descriptor with line @@ -55,10 +55,19 @@ function inventoryAdminPrepareHead() return $head; } +/** + * Define head array for tabs of inventory tools setup pages + * + * @param Inventory $inventory Object inventory + * @param string $title parameter + * @param string $get parameter + * + * @return array Array of head + */ function inventoryPrepareHead(&$inventory, $title='Inventory', $get='') { global $langs; - + return array( array(dol_buildpath('/product/inventory/card.php?id='.$inventory->id.$get, 1), $langs->trans($title),'inventory') ); @@ -66,26 +75,33 @@ function inventoryPrepareHead(&$inventory, $title='Inventory', $get='') +/** + * Define head array for tabs of inventory tools setup pages + * + * @param Inventory $inventory Object inventory + * + * @return string html of products + */ function inventorySelectProducts(&$inventory) { global $conf,$db,$langs; - + $except_product_id = array(); - + foreach ($inventory->Inventorydet as $Inventorydet) { $except_product_id[] = $Inventorydet->fk_product; } - + ob_start(); $form = new Form($db); $form->select_produits(-1, 'fk_product'); - + $TChildWarehouses = array($inventory->fk_warehouse); $e = new Entrepot($db); $e->fetch($inventory->fk_warehouse); if(method_exists($e, 'get_children_warehouses')) $e->get_children_warehouses($e->id, $TChildWarehouses); - + $Tab = array(); $sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'entrepot WHERE rowid IN('.implode(', ', $TChildWarehouses).')'; @@ -96,9 +112,8 @@ function inventorySelectProducts(&$inventory) } print '   '; print $langs->trans('Warehouse').' : '.$form::selectarray('fk_warehouse', $Tab); - + $select_html = ob_get_clean(); - + return $select_html; } - diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 0fa25cdba6e..bdaaff20988 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -53,6 +53,11 @@ class ProductAttribute */ public $rang; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ public function __construct(DoliDB $db) { global $conf; diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index 9b455851507..2988fd9715e 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -52,8 +52,13 @@ class ProductAttributeValue */ public $value; - public function __construct(DoliDB $db) - { + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) + { global $conf; $this->db = $db; diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 92bba2f70f8..58eb2178da4 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -70,7 +70,12 @@ class ProductCombination */ public $entity; - public function __construct(DoliDB $db) + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) { global $conf; diff --git a/htdocs/variants/class/ProductCombination2ValuePair.class.php b/htdocs/variants/class/ProductCombination2ValuePair.class.php index 874cedb101a..7332670f684 100644 --- a/htdocs/variants/class/ProductCombination2ValuePair.class.php +++ b/htdocs/variants/class/ProductCombination2ValuePair.class.php @@ -52,10 +52,15 @@ class ProductCombination2ValuePair */ public $fk_prod_attr_val; - public function __construct(DoliDB $db) - { - $this->db = $db; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) + { + $this->db = $db; + } /** * Translates this class to a human-readable string