protected function _serializeInto(array $data, $name)
 {
     $ext = $this->encoder->name();
     $filename = "{$this->path}/{$name}.{$ext}";
     echo "+ saving {$filename}\n";
     file_put_contents($filename, $this->encoder->encode($data));
 }
Example #2
0
 /**
  * Export SheetId collection into separate smaller files
  *
  * @param array $data
  * @param $sheet
  */
 function export(array $data, $sheet)
 {
     $groups = array();
     // split full list into separate files
     // reading them back in is a lot faster this way
     foreach ($data as $id => $array) {
         $key = floor($id / 1000000);
         $groups[$key][$id] = $array['name'] . '.' . $array['sheet'];
     }
     $ext = $this->encoder->name();
     foreach ($groups as $key => $array) {
         $idx = sprintf("%02x", $key);
         $filename = "{$this->path}/{$sheet}-{$idx}.{$ext}";
         file_put_contents($filename, $this->encoder->encode($array));
     }
 }