private function WeatherCommands::read in Weather 8
Same name and namespace in other branches
- 2.0.x src/Commands/WeatherCommands.php \Drupal\weather\Commands\WeatherCommands::read()
Read.
File
- src/
Commands/ WeatherCommands.php, line 79
Class
- WeatherCommands
- Drush command to add support to weather module (import weather csv file).
Namespace
Drupal\weather\CommandsCode
private function read() : self {
$file = $this
->csv();
$i = 0;
$items = [];
while (($line = fgetcsv($file, 0, ' ')) !== FALSE) {
$items[] = $line;
if (++$i % 500 === 0) {
$this
->logger()
->info("read {$i}");
}
}
fclose($file);
$this->items = $items;
return $this;
}