Code smell.

This commit is contained in:
Ivor Barhansky
2022-12-17 01:20:43 +02:00
parent b1f578f4b0
commit 0398425205
45 changed files with 875 additions and 851 deletions
+28 -26
View File
@@ -15,38 +15,40 @@ class Stats
return Db::getInstance()->ofetch('select id, strength, dexterity, intuition, endurance, intelligence, wisdom, health, mana, free_stat_points, level from users where ' . $col . ' = ?', $user);
}
public static function addOne(string $stat, int $user_id)
public static function addOne(string $stat, int $userId)
{
Db::getInstance()->execute("
UPDATE
users
SET
$stat = $stat + 1,
free_stat_points = free_stat_points - 1
WHERE
id = ?
", $user_id);
Db::getInstance()->execute(
"UPDATE
users
SET
$stat = $stat + 1,
free_stat_points = free_stat_points - 1
WHERE
id = ?",
$userId
);
}
public static function save(array $vars)
{
Db::getInstance()->execute('
update
users
set
strength = ?,
dexterity = ?,
intuition = ?,
Db::getInstance()->execute(
'update
users
set
strength = ?,
dexterity = ?,
intuition = ?,
endurance = ?,
intelligence = ?,
wisdom = ?,
health = ?,
mana = ?,
intelligence = ?,
wisdom = ?,
health = ?,
mana = ?,
free_stat_points = ?,
level = ?
where
id = ?
', $vars);
level = ?
where
id = ?',
$vars
);
}
}
}