/** * [processMessage 处理消息] * @param [type] $envelope [AMQPEnvelope] * @param [type] $queue [AMQPQueue] * @return [type] [description] */ public static function processMessage($envelope, $queue) { $msg = $envelope->getBody(); $this->logger->info("start process message :" . $msg); $msg = json_decode($msg, true); $worker = new PkgWorker(); $worker->process($msg); $this->logger->info("end process message :" . $msg); $queue->ack($envelope->getDeliveryTag()); }
/** * [parseResponse description] * @param [type] $response [description] * @return [type] [description] */ protected function parseResponse($response) { if (!$response instanceof Response) { return $response; } if ($this->dataType == 'json') { return $response->json(); } else { if ($this->dataType == 'xml') { return $response->xml(); } } return $response->getBody(); }
/** * Get the personal details of the Medium user * @return object */ private function data() { $result = json_decode($this->response->getBody()); return $result->data; }
/** * @param [type] $res * @return string|null */ protected function getResponseGenerator($res) { $body = $res->getBody(); $cmsVersion = array(); if (preg_match("/\\<meta name\\=\"generator\" content\\=\"([^\"]+)\"/", (string) $body, $cmsVersion) > 0) { return $cmsVersion[1]; } return null; }