You are here

public static function GdprTasksSarWorker::readCsv in General Data Protection Regulation 8.2

Same name and namespace in other branches
  1. 8 modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php \Drupal\gdpr_tasks\Plugin\QueueWorker\GdprTasksSarWorker::readCsv()
  2. 3.0.x modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php \Drupal\gdpr_tasks\Plugin\QueueWorker\GdprTasksSarWorker::readCsv()

Read data from a CSV file.

@todo: Use something like this instead: \Consolidation\OutputFormatters\Formatters\CsvFormatter

Parameters

string $filename: The filename to read from (supports streams).

Return value

array CSV file data.

File

modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php, line 441

Class

GdprTasksSarWorker
Processes SARs tasks when data processing is required.

Namespace

Drupal\gdpr_tasks\Plugin\QueueWorker

Code

public static function readCsv($filename) {
  $data = [];
  $handle = fopen($filename, 'rb');
  while (!feof($handle)) {
    $data[] = fgetcsv($handle);
  }
  fclose($handle);
  return $data;
}