battles/classes/Battles/Check.php
Ivor Barhansky 0398425205 Code smell.
2022-12-17 03:03:56 +02:00

35 lines
690 B
PHP

<?php
# Date: 15.03.2021 (21:53)
namespace Battles;
use Battles\Database\Db;
class Check
{
private User $user;
private Db $db;
/**
* Check constructor.
*
* @param User $user
* @param Db $db
*/
public function __construct(User $user, Db $db)
{
$this->user = $user;
$this->db = $db;
}
public static function expiredEffects()
{
return Db::getInstance()->execute('delete from users_effects where remaining_time <= ?', strtotime('now'));
}
public static function userExists($id): bool
{
return Db::getInstance()->fetchColumn('select count(*) from users where id = ?', $id) > 0;
}
}