/** * @param string $dataset * * @return false|array */ public function parse($dataset) { $data = false; $path = $this->finder->findDataset($dataset, self::FORMAT); if (false !== $path) { $content = $this->finder->getContent($path); if (null !== $content) { $data = $this->getFieldsFromContent($content); } } return $data; }
/** * @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; }
/** * @param Download $download * * @return null|string */ public function getLocalDatasetContent(Download $download) { $content = null; $filepath = $this->finder->findDataset($download->getDataset(), $download->getFormat(), $download->getFilter()); if (false !== $filepath) { $content = $this->finder->getContent($filepath); } return $content; }