Phergie_Connection_Handler::removeConnection PHP Method

removeConnection() public method

Removes a connection from the connection list.
public removeConnection ( Phergie_Connection | string $connection ) : Phergie_Connection_Handler
$connection Phergie_Connection | string Instance or hostmask for the connection to remove
return Phergie_Connection_Handler Provides a fluent interface
    public function removeConnection($connection)
    {
        if ($connection instanceof Phergie_Connection) {
            $hostmask = (string) $connection->getHostmask();
        } elseif (is_string($connection) && isset($this->connections[$connection])) {
            $hostmask = $connection;
        } else {
            return $this;
        }
        unset($this->connections[$hostmask]);
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * Sends resulting outgoing events from earlier processing in handleEvents().
  *
  * @param Phergie_Connection $connection Active connection
  *
  * @return void
  */
 protected function processEvents(Phergie_Connection $connection)
 {
     $this->plugins->preDispatch();
     if (count($this->events)) {
         foreach ($this->events as $event) {
             $this->ui->onCommand($event, $connection);
             $method = 'do' . ucfirst(strtolower($event->getType()));
             call_user_func_array(array($this->driver, $method), $event->getArguments());
         }
     }
     $this->plugins->postDispatch();
     if ($this->events->hasEventOfType(Phergie_Event_Request::TYPE_QUIT)) {
         $this->ui->onQuit($connection);
         $this->connections->removeConnection($connection);
     }
     $this->events->clearEvents();
 }
All Usage Examples Of Phergie_Connection_Handler::removeConnection