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
+10 -10
View File
@@ -7,7 +7,7 @@ use Battles\Models\User\Effects;
class Clan
{
private static ?self $_instance = null;
private static ?self $instance = null;
private $clan;
private function __construct()
@@ -17,10 +17,10 @@ class Clan
public static function getInstance(): self
{
if (is_null(self::$_instance)) {
self::$_instance = new self();
if (is_null(self::$instance)) {
self::$instance = new self();
}
return self::$_instance;
return self::$instance;
}
public function addMember(string $login): string
@@ -46,6 +46,11 @@ class Clan
return "Персонаж «{$login}» успешно принят в клан.";
}
private function getProverka($userId)
{
return Effects::count($userId, 20);
}
public function removeMember(string $login): string
{
$error = null;
@@ -96,11 +101,6 @@ class Clan
return Db::getInstance()->fetchAll('select id, (select 1 from clans where short_name = clan and owner_id = id) as clan_owner, room from users where clan = ? order by clan_owner desc, room, login', User::getInstance()->getClan());
}
private function getProverka($user_id)
{
return Effects::count($user_id, 20);
}
public function getClanOwnerId(): ?int
{
return $this->clan->owner_id;
@@ -115,4 +115,4 @@ class Clan
{
return $this->clan->short_name;
}
}
}