/** * Represents the "get_categories" action. * * @throws ShopgateLibraryException * @see http://wiki.shopgate.com/Shopgate_Plugin_API_get_categories */ protected function getCategories() { $limit = isset($this->params['limit']) ? (int) $this->params['limit'] : null; $offset = isset($this->params['offset']) ? (int) $this->params['offset'] : null; $uids = isset($this->params['uids']) ? (array) $this->params['uids'] : array(); $responseType = isset($this->params['response_type']) ? $this->params['response_type'] : false; $supportedResponseTypes = $this->config->getSupportedResponseTypes(); if (!empty($responseType) && !in_array($responseType, $supportedResponseTypes['get_categories'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_UNSUPPORTED_RESPONSE_TYPE, 'Requested type: "' . $responseType . '"'); } $this->plugin->startGetCategories($limit, $offset, $uids, $responseType); switch ($responseType) { default: case 'xml': $response = new ShopgatePluginApiResponseAppXmlExport($this->trace_id); $responseData = $this->config->getCategoriesXmlPath(); break; case 'json': $response = new ShopgatePluginApiResponseAppJsonExport($this->trace_id); $responseData = $this->config->getCategoriesJsonPath(); break; } if (empty($this->response)) { $this->response = $response; } $this->responseData = $responseData; }