sonar resolve bugs
continuous-integration/drone/push Build is passing Details

LoginModification
alexi 2 years ago
parent f2853c65f6
commit dd0eec1970

@ -11,7 +11,7 @@ class Clean
* @return string La chaîne nettoyée
*/
static function simpleString(string $string): string
public static function simpleString(string $string): string
{
$string = trim($string);
$string = strip_tags($string);
@ -25,7 +25,7 @@ class Clean
* @return string La chaîne nettoyée
*/
static function email($email): string
public static function email($email): string
{
$email = self::simpleString($email);
return filter_var($email, FILTER_SANITIZE_EMAIL);
@ -38,7 +38,7 @@ class Clean
* @return int Le nombre entier formaté
*/
static function int(int $int): int
public static function int(int $int): int
{
return filter_var($int, FILTER_SANITIZE_NUMBER_INT);
}

@ -11,13 +11,10 @@ class Validate
* @return bool Vrai si l'adresse e-mail est valide et respecte la longueur maximale définie, faux sinon.
*/
static function email (String $email): bool
public static function email (String $email): bool
{
global $emailMaxLength;
if(filter_var($email, FILTER_VALIDATE_EMAIL) && strlen($email) <= $emailMaxLength){
return true;
}
else return false;
return (filter_var($email, FILTER_VALIDATE_EMAIL) && strlen($email) <= $emailMaxLength);
}
/**
@ -28,13 +25,10 @@ class Validate
* @return bool Vrai si le pseudo est valide, faux sinon.
*/
static function pseudo(string $pseudo) : bool
public static function pseudo(string $pseudo) : bool
{
global $pseudoMaxLength;
if(strlen($pseudo) >= 3 && preg_match("#[a-zA-Z0-9]+#", $pseudo) && strlen($pseudo) <= $pseudoMaxLength){
return true;
}
else return false;
return (strlen($pseudo) >= 3 && preg_match("#[a-zA-Z0-9]+#", $pseudo) && strlen($pseudo) <= $pseudoMaxLength);
}
/**
@ -45,13 +39,10 @@ class Validate
* @return bool Vrai si le mot de passe est valide, faux sinon.
*/
static function password(string $password) : bool
public static function password(string $password) : bool
{
global $passwordMaxLength;
if(strlen($password) >= 8 && strlen($password) <=$passwordMaxLength && preg_match("#[0-9]+#", $password) && preg_match("#[a-zA-Z]+#", $password)){
return true;
}
else return false;
return (strlen($password) >= 8 && strlen($password) <=$passwordMaxLength && preg_match("#[0-9]+#", $password) && preg_match("#[a-zA-Z]+#", $password));
}
/**
@ -61,12 +52,10 @@ class Validate
* @return bool Vrai si le mot-clé est valide, faux sinon.
*/
static function keyWord(string $keyword) : bool
public static function keyWord(string $keyword) : bool
{
global $keyWordMaxLength;
if (strlen($keyword) <= $keyWordMaxLength && strlen($keyword) >= 3)
return true;
else return false;
return (strlen($keyword) <= $keyWordMaxLength && strlen($keyword) >= 3);
}
/**
@ -76,12 +65,10 @@ class Validate
* @return bool Vrai si le titre est valide, faux sinon.
*/
static function title(string $title) : bool
public static function title(string $title) : bool
{
global $titleMaxLength;
if (strlen($title) <= $titleMaxLength && strlen($title) >= 3)
return true;
else return false;
return (strlen($title) <= $titleMaxLength && strlen($title) >= 3);
}
/**
@ -91,12 +78,10 @@ class Validate
* @return bool Vrai si le type est valide, faux sinon.
*/
static function type(string $type) : bool
public static function type(string $type) : bool
{
global $typeMaxLength;
if (strlen($type) <= $typeMaxLength && strlen($type) >=3)
return true;
else return false;
return (strlen($type) <= $typeMaxLength && strlen($type) >=3);
}
/**
@ -106,10 +91,8 @@ class Validate
* @return bool Vrai si la réponse est valide, faux sinon.
*/
static function response(string $response) : bool{
public static function response(string $response) : bool{
global $responseMaxLength;
if(strlen($response) <= $responseMaxLength)
return true;
else return false;
return (strlen($response) <= $responseMaxLength);
}
}
Loading…
Cancel
Save