2021-08-25 01:44:36 +00:00
|
|
|
<?php
|
|
|
|
# Date: 15.03.2021 (21:53)
|
|
|
|
|
|
|
|
namespace Battles;
|
|
|
|
|
2022-01-26 23:15:33 +00:00
|
|
|
use Battles\Database\Db;
|
2021-08-25 01:44:36 +00:00
|
|
|
|
|
|
|
class Check
|
|
|
|
{
|
|
|
|
private User $user;
|
2022-01-26 23:15:33 +00:00
|
|
|
private Db $db;
|
2021-08-25 01:44:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check constructor.
|
|
|
|
*
|
|
|
|
* @param User $user
|
2022-08-09 19:57:43 +00:00
|
|
|
* @param Db $db
|
2021-08-25 01:44:36 +00:00
|
|
|
*/
|
2022-01-26 23:15:33 +00:00
|
|
|
public function __construct(User $user, Db $db)
|
2021-08-25 01:44:36 +00:00
|
|
|
{
|
|
|
|
$this->user = $user;
|
|
|
|
$this->db = $db;
|
|
|
|
}
|
|
|
|
|
2022-08-09 19:57:43 +00:00
|
|
|
public static function expiredEffects()
|
2021-08-25 01:44:36 +00:00
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
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;
|
2021-08-25 01:44:36 +00:00
|
|
|
}
|
2022-12-16 23:20:43 +00:00
|
|
|
}
|