From bcdee4e03822d6356ed175fc61aa9706b966e267 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 15 Mar 2015 22:06:42 +0800 Subject: [PATCH] update php petstore sample code --- samples/client/petstore/php/Swagger.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/samples/client/petstore/php/Swagger.php b/samples/client/petstore/php/Swagger.php index 1d5e7dbda50a..5c6ac134307c 100644 --- a/samples/client/petstore/php/Swagger.php +++ b/samples/client/petstore/php/Swagger.php @@ -127,27 +127,16 @@ class APIClient { // Handle the response if ($response_info['http_code'] == 0) { -<<<<<<< HEAD throw new APIClientException("TIMEOUT: api call to " . $url . " took more than 5s to return", 0, $response_info, $response); - } else if ($response_info['http_code'] == 200) { -======= - throw new Exception("TIMEOUT: api call to " . $url . - " took more than 5s to return" ); } else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) { ->>>>>>> add logic to handle all 2xx response code, bug fix for string response, $data = json_decode($response); if (json_last_error() > 0) { // if response is a string $data = $response; } } else if ($response_info['http_code'] == 401) { -<<<<<<< HEAD throw new APIClientException("Unauthorized API request to " . $url . - ": " . json_decode($response)->message, 0, $response_info, $response); -======= - throw new Exception("Unauthorized API request to " . $url . - ": ".serialize($response)); ->>>>>>> add logic to handle all 2xx response code, bug fix for string response, + ": " . serialize($response), 0, $response_info, $response); } else if ($response_info['http_code'] == 404) { $data = null; } else {