Pagekit\Auth\Handler\DatabaseHandler::read PHP Метод

read() публичный Метод

public read ( )
    public function read()
    {
        if ($token = $this->getToken() and $data = $this->connection->executeQuery("SELECT user_id, status, access FROM {$this->config['table']} WHERE id = :id AND status > :status", ['id' => sha1($token), 'status' => self::STATUS_INACTIVE])->fetch(\PDO::FETCH_ASSOC)) {
            if (strtotime($data['access']) + $this->config['timeout'] < time()) {
                if ($data['status'] == self::STATUS_REMEMBERED) {
                    $this->write($data['user_id'], self::STATUS_REMEMBERED);
                } else {
                    return null;
                }
            }
            $this->connection->update($this->config['table'], ['access' => date('Y-m-d H:i:s')], ['id' => sha1($token)]);
            return $data['user_id'];
        }
        return null;
    }