private function parseJson($answer) { $json = json_decode($answer); if (json_last_error() !== JSON_ERROR_NONE) { throw new OWMException('OpenWeatherMap returned an invalid json object: ' . json_last_error_msg()); } return $json; }