/** * Logs with an arbitrary level. * * @param mixed $level * @param string $message * @param array $context * @return null */ public function log($level, $message, array $context = []) { foreach ($this->filters as $filter) { $shouldSend = call_user_func_array($filter, [$level, $message, $context]); if (!$shouldSend) { return; } } $message = $this->interpolate($message, $context); $this->hipChat->room($this->room)->send($message, $this->shouldNotify($level), $this->getColor($level)); }
/** * @param GuzzleRequest $request * @return GuzzleRequest */ private function processRequest(GuzzleRequest $request) { try { $response = $this->client->send($request); } catch (TransferException $e) { $json_exception = $e->getResponse()->json(); HipChat::throwException($json_exception['error']['code'], $json_exception['error']['message'], $request->getUrl()); } return $response; }
private function processRequest($request) { if ($request['status'] == 200 or $request['status'] == 201 or $request['status'] == 204) { return $request; } $response_array = $this->objectToArray($request['body']); HipChat::throwException($response_array['error']['code'], $response_array['error']['message'], $request['meta']['uri']); }