public function setCsv(array &$data, $detectHead = true)
    {
        $handle     = self::createMemoryHandle();
        if($detectHead && count($data)> 0){
            fputcsv($handle, array_keys($data[0]), $this->delimiter, $this->enclosure);
        }
        foreach ($data as $row) {
            fputcsv($handle, $row, $this->delimiter, $this->enclosure);
        }
        rewind($handle);
        $output = chr(255) . chr(254
            ) . mb_convert_encoding('sep=' . $this->delimiter . "\n" . stream_get_contents($handle),
                self::UTF_16_LE,
                $this->encodingFrom
            );
        $this->setData($output);
        fclose($handle);
    }