/** * @param QuarkClient $client * @param int $expect * @param string $cmd * * @throws QuarkArchException */ private function _cmd(QuarkClient $client, $expect, $cmd = '') { if (func_num_args() == 3) { $client->Send($cmd . "\r\n"); } $response = $client->Receive(QuarkClient::MODE_BUCKET); $code = substr($response, 0, 3); $this->_log .= $cmd . ': ' . $response . '<br>'; if ($code != $expect) { throw new QuarkArchException('SMTP server returned unexpected [' . $code . '] for command ' . $cmd); } }
/** * @param QuarkClient $client * * @return bool */ public function OnConnect(QuarkClient $client) { foreach ($this->_devices as $device) { $client->Send($this->_msg($device)); } $client->Close(); }