/** * Funkce parsující stav odpovědi od LM connectu * @param CurlResponse $response * @param string $message * @return string * @throws \Exception */ private function parseResponse($response, $message = '') { $body = $response->getResponse(); $body = simplexml_load_string($body); if (!$response->isOk() || $body['status'] == 'failure') { throw new \Exception(isset($body->message) ? (string) $body->message : $response->getCode()); } else { if ($body['status'] == 'success') { return isset($body->message) ? (string) $body->message : $message; } } throw new \Exception(sprintf('Response not in expected format (%s)', htmlspecialchars($response->getResponse()))); }