Méthode pour déconnecter l'utilisateur.

@return bool True si succès.
339524
public function logout() {

        $container = $this->getContainer();
        $my        = $container->get('user')->load();
        $session   = $container->get('session');
        $db        = $container->get('db');

        $my->setLastVisit();

        // On supprime la session PHP.
        $session->destroy();

        // On force la déconnexion de tous les utilisateurs avec cet id.
        $db->setQuery($db->getQuery(true)
            ->delete($db->quoteName('#__session'))
            ->where($db->quoteName('userid') . ' = ' . (int)$my->id))
            ->execute();

        // On supprime tous les cookie d'authentification de l'utilisateur.
        $cookieName  = $this->getShortHashedUserAgent();
        $cookieValue = $this->input->cookie->get($cookieName);

        // S'il n y a de cookie à supprimer.
        if (!$cookieValue) {
            return true;
        }

        $cookieArray = explode('.', $cookieValue);

        // On filtre la série car on l'utilise dans la requête.
        $filter = new InputFilter;
        $series = $filter->clean($cookieArray[1], 'ALNUM');

        // On supprime l'enregistrement dans la base de données.
        $query = $db->getQuery(true);
        $query->delete('#__user_keys')
            ->where($db->quoteName('series') . ' = ' . $db->quote($series));
        $db->setQuery($query)
            ->execute();

        // On supprime le cookie.
        $this->input->cookie->set($cookieName, false, time() - 42000, $this->get('cookie.path', '/'), $this->get('cookie.domain'));

        return true;

    }
1167142
public function delete()
    {
        $result = false;

        if ($this->isConnected())
        {
            if (!$this->isNew()) {
                $result = $this->getTable()->delete($this);
            }
        }

        return (bool) $result;
    }
989864
public function disconnect()
	{
		if( $this->xmpp )
		{
			if( $this->printLog )
				echo $this->xmpp->log->printout();
			$this->xmpp->disconnect();
			$this->xmpp = NULL;
			return TRUE;
		}
		return FALSE;
	}
424981
public function isStreaming(): bool
    {
        $prefixes = [
            # Standard streams
            "x-sonosapi-stream:",

            # Other streams (eg Amazon)
            "x-sonosapi-radio:",

            # Line in
            "x-rincon-stream:",

            # Line in (playbar)
            "x-sonos-htastream:",
        ];

        $media = $this->getMediaInfo();

        foreach ($prefixes as $prefix) {
            if (strpos($media["CurrentURI"], $prefix) === 0) {
                return true;
            }
        }

        return false;
    }
813190
public function close()
    {
        if ($this->closed) {
            return false;
        }
        $this->closed = true;
        if ($this->fdCacheKey !== null) {
            FileSystem::$fdCache->invalidate($this->fdCacheKey);
        }
        if ($this->fd === null) {
            return false;
        }

        if (!FileSystem::$supported) {
            fclose($this->fd);
            return false;
        }
        $r = eio_close($this->fd, EIO_PRI_MAX);
        $this->fd = null;
        return $r;
    }
1041233
public function unbind()
	{
		if ($this->isBound && $this->resource && \is_resource($this->resource))
		{
			return ldap_unbind($this->resource);
		}

		return true;
	}
306272
public function deleteOutdated(): bool
    {
        $keys = $this->db->keys('*');
        foreach ($keys as $key) {
            try {
                $packet = $this->getPacket($key);
                if ($packet->outdated()) {
                    $this->delete($key);
                }
            } catch (BadPacketException $e) {
                $this->delete($key);
            }
        }
        return true;
    }
747306
public function enabled() {
		if (!parent::enabled()) {
			return false;
		}

		if (StorageManager::driver() != 's3') {
			return false;
		}

		if (empty($this->region) || empty($this->key) || empty($this->secret)) {
			return false;
		}

		$client = StorageManager::storageInstance();
		if (!$client->enabled()) {
			return false;
		}

		return ($this->detectLabels || $this->detectFaces || $this->detectExplicit || $this->detectCelebrities);
	}
1019880
public function close()
    {
        if (is_resource($this->socket)) {
            Debug::Log(Debug::DEBUG, 'socket_close()');
            return fclose($this->socket);
        }

        return true;
    }
341579
public function connected()
    {
        if (is_resource($this->smtp_conn)) {
            $sock_status = stream_get_meta_data($this->smtp_conn);
            if ($sock_status['eof']) {
                // the socket is valid but we are not connected
                if ($this->do_debug >= 1) {
                    $this->edebug(
                        'SMTP NOTICE: EOF caught while checking if connected'
                    );
                }
                $this->close();
                return false;
            }
            return true; // everything looks good
        }
        return false;
    }
1200270
private function disconnect()
    {
        $r = $this->write('QUIT');

        fclose($this->sock);

        $this->sock = null;

        return $r;
    }
64221
public function unlock(): bool
    {
        $result = false;

        if ($this->locker->releaseLock()) {
            $result = true;
        }

        return $result;
    }
830110
public function connect()
    {
        if ($this->ssl !== false) {
            $function = 'ftp_ssl_connect';
        } else {
            $function = 'ftp_connect';
        }

        $result = call_user_func_array($function, array($this->host, $this->port, $this->timeout));

        if (!$result) {
            return false;
        } else {
            $this->stream = $result;
            return true;
        }
    }
73207
public function isConnected()
    {
        return ((bool) (is_resource($this->_connection)
                    && (get_resource_type($this->_connection) == 'oci8 connection'
                     || get_resource_type($this->_connection) == 'oci8 persistent connection')));
    }
726336
protected function isConnectionLostAndShouldItBeReestablished(): bool
	{
		return ($this->reconnect === true && $this->inTransaction() === false && $this->isAlive() === false);
	}
695734
public function delete(): bool
    {
        if ($this->isLeaf()) {
            return (bool)parent::delete();
        }

        return (bool)$this->objects()->filter([
            'lft__gte' => $this->lft,
            'rgt__lte' => $this->rgt,
            'root' => $this->root,
        ])->delete();
    }
939994
public function close()
    {
        if (!$this->connected) {
            return false;
        }

        $this->connected = false;
        fclose($this->socket);

        return true;
    }