Пример #1
0
 /**
  * Creates a CSV Reader
  *
  * @param string $filename
  * @param string $delimiter
  * @param string $enclosure
  * @param string $escape
  * @param bool $withHeader
  * @param string $openMode
  * @return \PhillipsData\Csv\Reader
  */
 public static function reader($filename, $delimiter = ',', $enclosure = '"', $escape = '\\', $withHeader = true, $openMode = 'r')
 {
     $file = static::fileObject($filename, $openMode);
     $file->setCsvControl($delimiter, $enclosure, $escape);
     $reader = Reader::input($file, $withHeader);
     return $reader;
 }
Пример #2
0
 /**
  * Retrieves an instance of the Reader
  *
  * @return \PhillipsData\Csv\Reader
  */
 private function getReader($headers = false, $headerType = 'without')
 {
     $filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . $headerType . '-header.csv';
     return Reader::input(new SplFileObject($filename), $headers);
 }