Ejemplo n.º 1
0
 /**
  * @param string $dataset
  * @param string $format
  * @param string $filter
  * @param bool $updateExisting
  *
  * @return false|string downloaded file content
  */
 public function download($dataset, $format, $filter = null, $updateExisting = false)
 {
     $result = false;
     $parameters = array('dataset' => $dataset, 'format' => $format);
     if (isset($filter)) {
         $parameters['q'] = $filter;
     }
     $this->client->setTimeout(0);
     $content = $this->client->get('download', $parameters);
     $save = $this->finder->save($dataset, $content, $format, $filter, $updateExisting);
     if (false !== $save) {
         $result = $this->finder->getContent($save);
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * Look locally (parsers)
  *
  * @param Search $search
  *
  * @return array|false
  */
 private function searchDistant(Search $search)
 {
     $data = array();
     $result = $this->client->get('search', $search->getParameters());
     if ($result) {
         $result = json_decode($result, true);
         foreach ($result['records'] as $record) {
             $data[] = $record['fields'];
         }
     }
     return $data;
 }