| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 21 | 
| Code Lines | 15 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 23 | public static function getResponse(Request $request, ApiSalesforce $service)  | 
            ||
| 24 |     { | 
            ||
| 25 |         try { | 
            ||
| 26 | $response = $service->send($request);  | 
            ||
| 27 |         } catch (\Exception $e) { | 
            ||
| 28 | throw new HttpClientException($e->getMessage());  | 
            ||
| 29 | }  | 
            ||
| 30 |         if ($response->getStatusCode() == 500) { | 
            ||
| 31 | $error = 'API error: ' . $response->getBody()->getContents();  | 
            ||
| 32 | $service->addError($error);  | 
            ||
| 33 | throw new ApiRequestException($error);  | 
            ||
| 34 | }  | 
            ||
| 35 |         if ($response->getStatusCode() >= 300) { | 
            ||
| 36 | $error =  | 
            ||
| 37 | 'API error: Status = ' . $response->getStatusCode() . ' ; ReasonPhrase = '  | 
            ||
| 38 | . $response->getReasonPhrase() . ' ; Body = ' . $response->getBody()->getContents();  | 
            ||
| 39 | $service->addError($error);  | 
            ||
| 40 | throw new ApiResponseException($error);  | 
            ||
| 41 | }  | 
            ||
| 42 | |||
| 43 | return $response;  | 
            ||
| 44 | }  | 
            ||
| 45 | }  |