/** * Load the csv file or create a temporary file, if $input is * a string containing the csv data. * * @param string $input * @param int $size * @param string $delimiter * @param string $enclosure * @param string $escape * @return MonoCsv * @throws Exception */ public static function load($input, $size = null, $delimiter = ";", $enclosure = "\"", $escape = "\\") { $csv = new self(); if (is_file($input)) { $csv->spl = new SplFileObject($input); } else { $csv->setMaxInputSize($size); $csv->validateMaxInputSize($input); $csv->spl = new SplTempFileObject($csv->size); $csv->spl->fwrite($input); $csv->spl->rewind(); } $csv->spl->setCsvControl($delimiter, $enclosure, $escape); return $csv; }