private function createSuggestions()
 {
     $suggestions = array();
     $this->useJsonResponseContentProcessor();
     if (isset($this->parameters['format'])) {
         $oldFormat = $this->parameters['format'];
     }
     $this->parameters['format'] = 'json';
     $suggestData = $this->getResponseContent();
     if (parent::isValidResponse($suggestData)) {
         if (isset($suggestData['suggestions'])) {
             $suggestData = $suggestData['suggestions'];
         }
         foreach ($suggestData as $suggestQueryData) {
             $suggestLink = $this->convertServerQueryToClientUrl($suggestQueryData['searchParams']);
             $suggestAttributes = null;
             if (isset($suggestQueryData['attributes']) && is_array($suggestQueryData['attributes'])) {
                 $suggestAttributes = $suggestQueryData['attributes'];
             } else {
                 $suggestAttributes = array();
             }
             $suggestions[] = FF::getInstance('Data\\SuggestQuery', $suggestQueryData['name'], $suggestLink, $suggestQueryData['hitCount'], $suggestQueryData['type'], $suggestQueryData['image'], $suggestAttributes);
         }
     }
     if (isset($oldFormat)) {
         $this->parameters['format'] = $oldFormat;
     }
     return $suggestions;
 }
 private function createTagCloud($requestQuery = null)
 {
     $tagCloud = array();
     $tagCloudData = $this->getResponseContent();
     if (parent::isValidResponse($tagCloudData)) {
         foreach ($tagCloudData as $tagQueryData) {
             $query = $tagQueryData['query'];
             // TODO: Once JIRA issue FF-5328 is fixed, retrieve the
             //       parameters from searchParams, like all other adapters
             //       do.
             $parameters = FF::getInstance('Util\\Parameters');
             $parameters['query'] = $query;
             $tagCloud[] = FF::getInstance('Data\\TagQuery', $query, $this->urlBuilder->generateUrl($parameters), $requestQuery == $query, $tagQueryData['weight'], $tagQueryData['searchCount']);
         }
     }
     return $tagCloud;
 }
 private function createComparedRecords()
 {
     $records = array();
     $parameters = $this->request->getParameters();
     if (!isset($parameters['ids'])) {
         $this->log->warn('Compared records cannot be loaded without product IDs. ' . 'Use setProductIDs() first.');
     } else {
         $position = 1;
         $jsonData = $this->getResponseContent();
         if (parent::isValidResponse($jsonData)) {
             foreach ($jsonData['records'] as $recordData) {
                 $records[] = FF::getInstance('Data\\Record', (string) $recordData['id'], $recordData['record'], 100.0, $position++);
             }
         }
     }
     return FF::getInstance('Data\\Result', $records, null, count($records));
 }
 private function createRecommendations()
 {
     $records = array();
     $parameters = $this->request->getParameters();
     if (!isset($parameters['id'])) {
         $this->log->warn('Recommendations cannot be loaded without a product ID. ' . 'Use setProductIDs() or addProductIDs() first.');
     } else {
         $recommenderData = $this->getResponseContent();
         if (parent::isValidResponse($recommenderData)) {
             if (isset($recommenderData['resultRecords'])) {
                 $recommenderData = $recommenderData['resultRecords'];
             }
             $position = 1;
             foreach ($recommenderData as $recordData) {
                 if ($this->idsOnly) {
                     $records[] = $this->createSparseRecord($recordData);
                 } else {
                     $records[] = $this->createRecord($recordData, $position++);
                 }
             }
         }
     }
     return FF::getInstance('Data\\Result', $records, null, count($records));
 }