/** * Merge a connection into this one. * If we have two connections that must run at the same time, the * Hoa\Socket\Connection::consider() and Hoa\Socket\Connection::is() methods * are helpful but this whole class eases the merge of “high-level” * connections. * * @param \Hoa\Socket\Connection\Handler $other Connection to merge. * @return \Hoa\Socket\Connection\Handler */ public function merge(self $other) { $thisConnection = $this->getConnection(); $otherConnection = $other->getConnection(); $thisConnection->consider($otherConnection); if ($otherConnection instanceof Socket\Server) { $other->setConnection($thisConnection); } $this->_connections[] = $other; return $this; }