public function __construct($harvester, $name, $parameters = array()) { parent::__construct($harvester, $name, $parameters); // Loading the list of production ids that have been banned. if (array_key_exists('datafile', $parameters)) { $datafile = $parameters['datafile']; $datafile = $harvester->resolvePath($datafile); if ($datafile) { $datafile = file_get_contents($datafile); $datafile_rows = str_getcsv($datafile, "\n"); array_shift($datafile_rows); // Remove the heading. foreach ($datafile_rows as $row) { /* $row = explode("\t", $row); if(count($row) != 4) { throw new \RuntimeException("Malformed datafile."); } $this->_whitelistedAssetIDs[] = $row[1]; */ $asset_id = intval($row); $this->_whitelistedAssetIDs[] = $asset_id; } } else { throw new \Exception("The " . __CLASS__ . " has to have a datafile parameter that points to a datafile."); } } else { throw new \Exception("The " . __CLASS__ . " has to have a datafile parameter."); } }
public function __construct($harvester, $name, $parameters = array()) { parent::__construct($harvester, $name, $parameters); // Loading the list of production ids that have been banned. if (array_key_exists('datafile', $parameters)) { $datafile = $parameters['datafile']; $datafile = $harvester->resolvePath($datafile); if ($datafile) { $datafile = file_get_contents($datafile); $datafile_rows = str_getcsv($datafile, "\n"); foreach ($datafile_rows as $row) { if (strlen($row) != 11) { throw new \RuntimeException("Malformed datafile, all rows have to have exact 11 charecters."); } $this->_bannedProductionIDs[] = $row; } } else { throw new \Exception("The " . __CLASS__ . " has to have a datafile parameter that points to a datafile."); } } else { throw new \Exception("The " . __CLASS__ . " has to have a datafile parameter."); } }