@@ -112,7 +112,7 @@ function request($method, $url, $body = NULL) {
112
112
curl_close ($ request );
113
113
114
114
$ headers = self ::parseHeaders (substr ($ response , 0 , $ headerSize ));
115
- $ body = substr ($ response , $ headerSize );
115
+ $ responseBody = substr ($ response , $ headerSize );
116
116
117
117
if (isset ($ headers ["compression-count " ])) {
118
118
Tinify::setCompressionCount (intval ($ headers ["compression-count " ]));
@@ -144,8 +144,8 @@ function request($method, $url, $body = NULL) {
144
144
145
145
if ($ isJson || $ isError ) {
146
146
/* Parse JSON bodies, always interpret errors as JSON. */
147
- $ body = json_decode ($ body );
148
- if (!$ body ) {
147
+ $ responseBody = json_decode ($ responseBody );
148
+ if (!$ responseBody ) {
149
149
$ message = sprintf ("Error while parsing response: %s (#%d) " ,
150
150
PHP_VERSION_ID >= 50500 ? json_last_error_msg () : "Error " ,
151
151
json_last_error ());
@@ -160,11 +160,11 @@ function request($method, $url, $body = NULL) {
160
160
if ($ status == 404 ) {
161
161
throw Exception::create (null , null , $ status );
162
162
} else {
163
- throw Exception::create ($ body ->message , $ body ->error , $ status );
163
+ throw Exception::create ($ responseBody ->message , $ responseBody ->error , $ status );
164
164
}
165
165
}
166
166
167
- return (object ) array ("body " => $ body , "headers " => $ headers );
167
+ return (object ) array ("body " => $ responseBody , "headers " => $ headers );
168
168
} else {
169
169
$ message = sprintf ("%s (#%d) " , curl_error ($ request ), curl_errno ($ request ));
170
170
curl_close ($ request );
0 commit comments