Example #1
0
File: IRC.php Project: nkreer/Fish
 /**
  * Close a connection
  * @param Connection $connection
  * @param String $quitMessage
  * @return bool
  */
 public function removeConnection(Connection $connection, string $quitMessage = null) : bool
 {
     if ($this->isConnected($connection->getAddress())) {
         Logger::info(BashColor::RED . "Disconnecting " . $connection->getAddress() . ":" . $connection->getPort());
         if ($quitMessage === null) {
             $quitMessage = $this->config->getData("default_quitmsg", "Leaving");
         }
         $connection->disconnect($quitMessage);
         unset($this->connections[$connection->getAddress()]);
         return true;
     } else {
         unset($this->connections[$connection->getAddress()]);
         return true;
         //These statements are kept for reasons of backwards-compatibility
     }
 }