Fix: Solve phpcodesniffer errors and warning

This commit is contained in:
Laurent Destailleur 2011-09-14 22:15:04 +00:00
parent 3cdc7abf40
commit 852a997559

View File

@ -72,6 +72,7 @@ class Categorie
* Load category into memory from database * Load category into memory from database
* *
* @param int $id Id of category * @param int $id Id of category
* @return int <0 if KO, >0 if OK
*/ */
function fetch($id) function fetch($id)
{ {
@ -290,7 +291,8 @@ class Categorie
/** /**
* Delete a category from database * Delete a category from database
* *
* @param user Object user that ask to delete * @param User $user Object user that ask to delete
* @return void
*/ */
function delete($user) function delete($user)
{ {
@ -399,7 +401,7 @@ class Categorie
/** /**
* Ajout d'une sous-categorie * Ajout d'une sous-categorie
* *
* @return int 1 : OK * @return int 1 : OK
* -2 : $fille est deja dans la famille de $this * -2 : $fille est deja dans la famille de $this
* -3 : categorie ($this ou $fille) invalide * -3 : categorie ($this ou $fille) invalide
*/ */
@ -422,9 +424,9 @@ class Categorie
/** /**
* Suppression d'une sous-categorie (seulement "desassociation") * Suppression d'une sous-categorie (seulement "desassociation")
* *
* @param $fille objet categorie * @param Category $fille Objet category
* @return int 1 : OK * @return int 1 : OK
* -3 : categorie ($this ou $fille) invalide * -3 : categorie ($this ou $fille) invalide
*/ */
function del_fille($fille) function del_fille($fille)
{ {
@ -450,9 +452,9 @@ class Categorie
/** /**
* Link an object to the category * Link an object to the category
* *
* @param obj Object to link to category * @param Object $obj Object to link to category
* @param type Type of category * @param string $type Type of category
* @return int 1 : OK, -1 : erreur SQL, -2 : id non renseign, -3 : Already linked * @return int 1 : OK, -1 : erreur SQL, -2 : id non renseign, -3 : Already linked
*/ */
function add_type($obj,$type) function add_type($obj,$type)
{ {
@ -484,11 +486,11 @@ class Categorie
} }
/** /**
* Suppresion d'un produit de la categorie * Delete object from category
* *
* @param $obj Object * @param Object $obj Object
* @param $type Type * @param string $type Type
* @return int 1 if OK, -1 if KO * @return int 1 if OK, -1 if KO
*/ */
function del_type($obj,$type) function del_type($obj,$type)
{ {
@ -510,9 +512,10 @@ class Categorie
/** /**
* Return list of contents of a category * Return list of contents of a category
* *
* @param field Field name for select in table. Full field name will be fk_field. * @param string $field Field name for select in table. Full field name will be fk_field.
* @param classname PHP Class of object to store entity * @param string $classname PHP Class of object to store entity
* @param table Table name for select in table. Full table name will be PREFIX_categorie_table. * @param string $table Table name for select in table. Full table name will be PREFIX_categorie_table.
* @return void
*/ */
function get_type($field,$classname,$table='') function get_type($field,$classname,$table='')
{ {
@ -547,8 +550,10 @@ class Categorie
/** /**
* Retourne les filles de la categorie * Retourne les filles de la categorie
*
* @return void
*/ */
function get_filles () function get_filles()
{ {
$sql = "SELECT fk_categorie_fille FROM ".MAIN_DB_PREFIX."categorie_association "; $sql = "SELECT fk_categorie_fille FROM ".MAIN_DB_PREFIX."categorie_association ";
$sql .= "WHERE fk_categorie_mere = ".$this->id; $sql .= "WHERE fk_categorie_mere = ".$this->id;
@ -587,13 +592,14 @@ class Categorie
$res = $this->db->query($sql); $res = $this->db->query($sql);
$n = $this->db->fetch_array($res); $n = $this->db->fetch_array($res);
return ($n[0]); return($n[0]);
} }
/** /**
* La categorie $fille est-elle une fille de cette categorie ? * La categorie $fille est-elle une fille de cette categorie ?
* *
* @param Category $fille Object category * @param Category $fille Object category
* @return void
*/ */
function is_fille($fille) function is_fille($fille)
{ {
@ -601,7 +607,6 @@ class Categorie
$sql .= "WHERE fk_categorie_mere = ".$this->id." AND fk_categorie_fille = ".$fille->id; $sql .= "WHERE fk_categorie_mere = ".$this->id." AND fk_categorie_fille = ".$fille->id;
$res = $this->db->query($sql); $res = $this->db->query($sql);
$n = $this->db->fetch_array($res); $n = $this->db->fetch_array($res);
return ($n[0] > 0); return ($n[0] > 0);
@ -724,8 +729,9 @@ class Categorie
/** /**
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel * For category id_categ and its childs available in this->cats, define property fullpath and fulllabel
* *
* @param id_categ id_categ entry to update * @param int $id_categ id_categ entry to update
* @param protection Deep counter to avoid infinite loop * @param int $protection Deep counter to avoid infinite loop
* @return void
*/ */
function build_path_from_id_categ($id_categ,$protection=0) function build_path_from_id_categ($id_categ,$protection=0)
{ {
@ -775,6 +781,8 @@ class Categorie
/** /**
* Affiche contenu de $this->cats * Affiche contenu de $this->cats
*
* @return void
*/ */
function debug_cats() function debug_cats()
{ {
@ -824,7 +832,7 @@ class Categorie
* *
* @return int Nombre de categories * @return int Nombre de categories
*/ */
function get_nb_categories () function get_nb_categories()
{ {
$sql = "SELECT count(rowid)"; $sql = "SELECT count(rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie";
@ -897,7 +905,9 @@ class Categorie
} }
/** /**
* Retourne les categories de premier niveau (qui ne sont pas filles) * Retourne les categories de premier niveau (qui ne sont pas filles)
*
* @return void
*/ */
function get_main_categories() function get_main_categories()
{ {
@ -926,6 +936,10 @@ class Categorie
/** /**
* Retourne les chemin de la categorie, avec les noms des categories * Retourne les chemin de la categorie, avec les noms des categories
* separes par $sep (" >> " par defaut) * separes par $sep (" >> " par defaut)
*
* @param string $sep Separator
* @param string $url Url
* @return void
*/ */
function print_all_ways ($sep = " &gt;&gt; ", $url='') function print_all_ways ($sep = " &gt;&gt; ", $url='')
{ {
@ -953,10 +967,11 @@ class Categorie
/** /**
* affiche le chemin le plus court pour se rendre a un produit * Affiche le chemin le plus court pour se rendre a un produit
* *
* @param id * @param int $id Id of category
* @param type * @param string $type Type of category
* @return void
*/ */
function get_primary_way($id, $type="") function get_primary_way($id, $type="")
{ {
@ -978,12 +993,13 @@ class Categorie
} }
/** /**
* Affiche le chemin le plus court pour se rendre a un produit * Affiche le chemin le plus court pour se rendre a un produit
* *
* @param int $id * @param int $id Id of category
* @param string $sep * @param string $sep Separator
* @param string $url * @param string $url Url
* @param string $type * @param string $type Type
* @return void
*/ */
function print_primary_way($id, $sep= " &gt;&gt; ", $url="", $type="") function print_primary_way($id, $sep= " &gt;&gt; ", $url="", $type="")
{ {
@ -1006,7 +1022,9 @@ class Categorie
} }
/** /**
* Retourne un tableau contenant la liste des categories meres * Retourne un tableau contenant la liste des categories meres
*
* @return void
*/ */
function get_meres() function get_meres()
{ {
@ -1033,8 +1051,10 @@ class Categorie
} }
/** /**
* Retourne dans un tableau tous les chemins possibles pour arriver a la categorie * Retourne dans un tableau tous les chemins possibles pour arriver a la categorie
* en partant des categories principales, representes par des tableaux de categories * en partant des categories principales, representes par des tableaux de categories
*
* @return void
*/ */
function get_all_ways () function get_all_ways ()
{ {
@ -1060,9 +1080,9 @@ class Categorie
/** /**
* Return list of categories linked to element of type $type with id $typeid * Return list of categories linked to element of type $type with id $typeid
* *
* @param id Id of element * @param int $id Id of element
* @param typeid Type id of link (0,1,2,3...) * @param int $typeid Type id of link (0,1,2,3...)
* @return array List of category objects * @return array List of category objects
*/ */
function containing($id,$typeid) function containing($id,$typeid)
{ {
@ -1101,11 +1121,11 @@ class Categorie
* Retourne les categories dont l'id ou le nom correspond * Retourne les categories dont l'id ou le nom correspond
* ajoute des wildcards au nom sauf si $exact = true * ajoute des wildcards au nom sauf si $exact = true
* *
* @param id * @param int $id Id
* @param nom * @param string $nom Name
* @param type * @param string $type Type
* @param exact * @param boolean $exact Ture or false
* @return int or array * @return array Array of category id
*/ */
function rechercher($id, $nom, $type, $exact = false) function rechercher($id, $nom, $type, $exact = false)
{ {
@ -1148,10 +1168,10 @@ class Categorie
/** /**
* Return name and link of category (with picto) * Return name and link of category (with picto)
* *
* @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param option Sur quoi pointe le lien ('', 'xyz') * @param string $option Sur quoi pointe le lien ('', 'xyz')
* @param maxlength Max length of text * @param int $maxlength Max length of text
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$option='',$maxlength=0) function getNomUrl($withpicto=0,$option='',$maxlength=0)
{ {
@ -1174,12 +1194,13 @@ class Categorie
/** /**
* Deplace fichier uploade sous le nom $files dans le repertoire sdir * Deplace fichier uploade sous le nom $files dans le repertoire sdir
* *
* @param sdir Repertoire destination finale * @param string $sdir Repertoire destination finale
* @param $file Nom du fichier uploade * @param string $file Nom du fichier uploade
* @param maxWidth Largeur maximum que dois faire la miniature (160 par defaut) * @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
* @param maxHeight Hauteur maximum que dois faire la miniature (120 par defaut) * @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
* @return void
*/ */
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120) function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
{ {
@ -1209,11 +1230,12 @@ class Categorie
} }
/** /**
* Build thumb * Build thumb
* *
* @param string $file Chemin du fichier d'origine * @param string $file Chemin du fichier d'origine
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut) * @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut) * @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
* @return void
*/ */
function add_thumb($file, $maxWidth = 160, $maxHeight = 120) function add_thumb($file, $maxWidth = 160, $maxHeight = 120)
{ {
@ -1282,7 +1304,8 @@ class Categorie
/** /**
* Efface la photo de la categorie et sa vignette * Efface la photo de la categorie et sa vignette
* *
* @param file Chemin de l'image * @param string $file Path to file
* @return void
*/ */
function delete_photo($file) function delete_photo($file)
{ {
@ -1307,9 +1330,10 @@ class Categorie
} }
/** /**
* Load size of image file * Load size of image file
* *
* @param file Path to file * @param string $file Path to file
* @return void
*/ */
function get_image_size($file) function get_image_size($file)
{ {
@ -1320,8 +1344,10 @@ class Categorie
/** /**
* Initialise an example of instance with random values * Initialise an example of instance with random values
* Used to build previews or test instances * Used to build previews or test instances
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {