<commit_before><?php

namespace SocioChat\DAO;

use PDO;
use SocioChat\Utils\DbQueryHelper;

class SessionDAO extends DAOBase
{
	const SESSION_ID = 'session_id';
	const ACCESS_TIME = 'access';
	const USER_ID = 'user_id';

	public function __construct()
	{
		parent::__construct(
			[
				self::SESSION_ID,
				self::ACCESS_TIME,
				self::USER_ID,
			]
		);

		$this->dbTable = 'sessions';
	}

	public function getSessionId()
	{
		return $this[self::SESSION_ID];
	}

	public function getAccessTime()
	{
		return $this[self::ACCESS_TIME];
	}

	public function getBySessionId($id)
	{
		return $this->getByPropId(self::SESSION_ID, $id);
	}

	public function getByUserId($userId)
	{
		return $this->getByPropId(self::USER_ID, $userId);
	}

	public function setSessionId($sessionId)
	{
		$this[self::SESSION_ID] = $sessionId;
		return $this;
	}

	public function setAccessTime($time)
	{
		$this[self::ACCESS_TIME] = $time;
		return $this;
	}

	public function setUserId($userId)
	{
		$this[self::USER_ID] = $userId;
		return $this;
	}

	public function getUserId()
	{
		return $this[self::USER_ID];
	}

	public function getObsoleteUserIds($deadLine)
	{
		if (!$unregisteredList = UserDAO::create()->getUnregisteredUserIds()) {
			return [];
		}

		$queryParams = array_merge([$deadLine], $unregisteredList);

		return $this->db->query(
			"SELECT user_id FROM {$this->dbTable} WHERE access < :0 AND user_id IN (".DbQueryHelper::commaSeparatedHolders($unregisteredList, 1).")",
			$queryParams,
			PDO::FETCH_COLUMN
		);
	}

	public function dropByUserId($userId)
	{
		$this->db->exec("DELETE FROM {$this->dbTable} WHERE user_id = ?", [$userId]);
	}

	public function dropByUserIdList(array $userIds)
	{
		$usersList = DbQueryHelper::commaSeparatedHolders($userIds);
		$this->db->exec("DELETE FROM {$this->dbTable} WHERE user_id IN ($usersList)", $userIds);
	}

	protected function getForeignProperties()
	{
		return [];
	}
}

<commit_msg>login fix<commit_after><?php

namespace SocioChat\DAO;

use PDO;
use SocioChat\Utils\DbQueryHelper;

class SessionDAO extends DAOBase
{
	const SESSION_ID = 'session_id';
	const ACCESS_TIME = 'access';
	const USER_ID = 'user_id';

	public function __construct()
	{
		parent::__construct(
			[
				self::SESSION_ID,
				self::ACCESS_TIME,
				self::USER_ID,
			]
		);

		$this->dbTable = 'sessions';
	}

	public function getSessionId()
	{
		return $this[self::SESSION_ID];
	}

	public function getAccessTime()
	{
		return $this[self::ACCESS_TIME];
	}

	public function getBySessionId($id)
	{
		return $this->getByPropId(self::SESSION_ID, $id);
	}

	public function getByUserId($userId)
	{
		return $this->getByPropId(self::USER_ID, $userId);
	}

	public function setSessionId($sessionId)
	{
		$this[self::SESSION_ID] = $sessionId;
		return $this;
	}

	public function setAccessTime($time)
	{
		$this[self::ACCESS_TIME] = $time;
		return $this;
	}

	public function setUserId($userId)
	{
		$this[self::USER_ID] = $userId;
		return $this;
	}

	public function getUserId()
	{
		return $this[self::USER_ID];
	}

	public function getObsoleteUserIds($deadLine)
	{
		if (!$unregisteredList = UserDAO::create()->getUnregisteredUserIds()) {
			return [];
		}

		$queryParams = array_merge([$deadLine], $unregisteredList);

		return $this->db->query(
			"SELECT user_id FROM {$this->dbTable} WHERE access < :0 AND user_id IN (".DbQueryHelper::commaSeparatedHolders($unregisteredList, 1).")",
			$queryParams,
			PDO::FETCH_COLUMN
		);
	}

	public function dropByUserId($userId)
	{
		$this->db->exec("DELETE FROM {$this->dbTable} WHERE user_id = :id", ['id' => $userId]);
	}

	public function dropByUserIdList(array $userIds)
	{
		$usersList = DbQueryHelper::commaSeparatedHolders($userIds);
		$this->db->exec("DELETE FROM {$this->dbTable} WHERE user_id IN ($usersList)", $userIds);
	}

	protected function getForeignProperties()
	{
		return [];
	}
}


{'fraction_non_alphanumeric': 0.15082644628099173, 'fraction_numerical': 0.0010330578512396695, 'mean_word_length': 4.746290801186944, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2865185', 'n_tokens_mistral': 1520, 'n_tokens_neox': 1407, 'n_words': 263}