/** * Converts the response in JSON format to the list of value objects i.e * Catalogue * * @params response * - response in JSON format * * @return List of Catalogue object filled with json data * */ function buildArrayResponse($json) { $cataloguesJSONObj = $this->getServiceJSONObject("catalogues", $json); $catalogueList = array(); if ($cataloguesJSONObj->__get("catalogue") instanceof JSONObject) { $catalogueJSONObj = $cataloguesJSONObj->__get("catalogue"); $catalogueJSONObj = new JSONObject($catalogueJSONObj); $objCatalogue = new Catalogue(); $catalogue = $objCatalogue->buildCatalogueObject($catalogueJSONObj); $catalogue->setStrResponse($json); $catalogue->setResponseSuccess($this->isRespponseSuccess($json)); array_push($catalogueList, $catalogue); } else { $catalogueJSONArray = $cataloguesJSONObj->getJSONArray("catalogue"); for ($i = 0; $i < count($catalogueJSONArray); $i++) { $catalogueJSONObj = $catalogueJSONArray[$i]; $objCatalogue = new Catalogue(); $catalogue = $objCatalogue->buildCatalogueObject($catalogueJSONObj); $catalogue->setStrResponse($json); $catalogue->setResponseSuccess($this->isRespponseSuccess($json)); array_push($catalogueList, $catalogue); } } return $catalogueList; }