コード例 #1
0
ファイル: CsvReader.php プロジェクト: plumphp/plum-csv
 /**
  * @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);
 }