Esempio n. 1
0
 public static function write(\CsvParser\Parser $parser, \CsvParser\Csv $csv, $size = 1000)
 {
     $data = $csv->getData();
     $chunks = array_chunk($data, $size, true);
     $end = array();
     foreach ($chunks as $chunk) {
         $end[] = new \CsvParser\Csv($chunk);
     }
     return $end;
 }
Esempio n. 2
0
 public static function write(\CsvParser\Parser $parser, \CsvParser\Csv $csv)
 {
     $data = $csv->getData();
     $output = array(implode($parser->fieldDelimiter, array_map(function ($value) use($parser) {
         return $parser->fieldEnclosure . str_replace($parser->fieldEnclosure, $parser->fieldEnclosure . $parser->fieldEnclosure, $value) . $parser->fieldEnclosure;
     }, array_keys(current($data)))));
     foreach ($data as $line) {
         $output[] = implode($parser->fieldDelimiter, array_map(function ($value) use($parser) {
             return $parser->fieldEnclosure . str_replace($parser->fieldEnclosure, $parser->fieldEnclosure . $parser->fieldEnclosure, $value) . $parser->fieldEnclosure;
         }, $line));
     }
     return implode($parser->lineDelimiter, $output);
 }
Esempio n. 3
0
 public static function write(\CsvParser\Parser $parser, \CsvParser\Csv $csv)
 {
     return $csv->getData();
 }