addLine($headers); } } public function addLine(array|Collection $row) { $str = ""; foreach ($row as $col => $val) { if ($str !== "") { $str .= ","; } $str .= $val; } if ($this->encode === static::ENCODE_SJIS) { $str = $this->toSjis($str); } $this->append($str); } private function toSjis(string $source): string { return mb_convert_encoding($source, "SJIS", "UTF8"); } }