22
33namespace Redmine \Api ;
44
5- use JsonException ;
65use Redmine \Api ;
76use Redmine \Client \Client ;
87use Redmine \Exception \SerializerException ;
@@ -165,7 +164,7 @@ protected function sanitizeParams(array $defaults, array $params)
165164 * Retrieves all the elements of a given endpoint (even if the
166165 * total number of elements is greater than 100).
167166 *
168- * @deprecated the `retrieveAll()` method is deprecated, use `retrieveData()` instead.
167+ * @deprecated the `retrieveAll()` method is deprecated, use `retrieveData()` instead
169168 *
170169 * @param string $endpoint API end point
171170 * @param array $params optional parameters to be passed to the api (offset, limit, ...)
@@ -297,7 +296,7 @@ protected function attachCustomFieldXML(SimpleXMLElement $xml, array $fields)
297296 }
298297
299298 /**
300- * returns the last response body as array
299+ * returns the last response body as array.
301300 *
302301 * @throws SerializerException if response body could not be converted into array
303302 */
@@ -310,14 +309,12 @@ private function getLastResponseBodyAsArray(): array
310309 // parse XML
311310 if (0 === strpos ($ contentType , 'application/xml ' )) {
312311 $ returnData = XmlSerializer::createFromString ($ body )->getNormalized ();
313- } else if (0 === strpos ($ contentType , 'application/json ' )) {
312+ } elseif (0 === strpos ($ contentType , 'application/json ' )) {
314313 $ returnData = JsonSerializer::createFromString ($ body )->getNormalized ();
315314 }
316315
317- if (! is_array ($ returnData )) {
318- throw new SerializerException (
319- 'Could not convert response body into array: ' . $ body
320- );
316+ if (!is_array ($ returnData )) {
317+ throw new SerializerException ('Could not convert response body into array: ' .$ body );
321318 }
322319
323320 return $ returnData ;
0 commit comments