public function encodeAlert($data) { $core = $this->core; $alert = new Alert(); $alert->encode($data); $this->content = $alert; $core->isClosed = true; if ($alert->getDescCode() != Alert::CLOSE_NOTIFY) { throw new TLSAlertException($alert, "Alert received from peer"); } }