/** * Requests a connection close * * @param int $reply_code * @param string $reply_text * @param array $method_sig * @return mixed|null */ public function close($reply_code = 0, $reply_text = '', $method_sig = array(0, 0)) { if ($this->io instanceof StreamIO) { $this->io->disableHeartbeat(); } if (!$this->protocolWriter || !$this->isConnected()) { return null; } $this->closeChannels(); list($class_id, $method_id, $args) = $this->protocolWriter->connectionClose($reply_code, $reply_text, $method_sig[0], $method_sig[1]); $this->send_method_frame(array($class_id, $method_id), $args); $this->setIsConnected(false); return $this->wait(array($this->waitHelper->get_wait('connection.close_ok'))); }