예제 #1
0
 /**
  * @param string $filePath  Path to the csv file to read from
  * @param string $delimiter The delimiter for the csv file
  * @param string $enclosure The enclosure for the csv file
  */
 public function __construct($filePath, $delimiter = ',', $enclosure = '"')
 {
     if (!is_file($filePath)) {
         throw new LogicException(sprintf('The file %s does not exist. \\Plum\\PlumCsv\\CsvReader needs an existing csv to work with', $filePath));
     }
     $this->csv = Reader::createFromPath($filePath);
     $this->csv->setFlags(\SplFileObject::READ_AHEAD | \SplFileObject::SKIP_EMPTY);
     $this->csv->setDelimiter($delimiter);
     $this->csv->setEnclosure($enclosure);
 }
예제 #2
0
파일: Data.php 프로젝트: zjean/firefly-iii
 /**
  *
  * @return Reader
  */
 public function getReader()
 {
     if (strlen($this->csvFileContent) === 0) {
         $this->loadCsvFile();
     }
     if (is_null($this->reader)) {
         $this->reader = Reader::createFromString($this->getCsvFileContent());
         $this->reader->setDelimiter($this->delimiter);
     }
     return $this->reader;
 }