readResponse = $str; return $this; } /** * Set the write response * * @param mixed $resp * @return MessageClient */ public function setWriteResponse($resp) { $this->writeResponse = $resp; return $this; } /** * Connect to Host * * @return MessageClient */ protected function connect($host, array $ssl) { return $this; } /** * Return Response * * @param string $length * @return string */ protected function read($length = 1024) { if (! $this->isConnected()) { throw new Exception\RuntimeException('You must open the connection prior to reading data'); } $ret = substr($this->readResponse, 0, $length); $this->readResponse = null; return $ret; } /** * Write and Return Length * * @param string $payload * @return int */ protected function write($payload) { if (! $this->isConnected()) { throw new Exception\RuntimeException('You must open the connection prior to writing data'); } $ret = $this->writeResponse; $this->writeResponse = null; return (null === $ret) ? strlen($payload) : $ret; } }