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f |NNTNЋ8uœԅju`@"gAnd1e❿nܧgX7jB 6u[yKnhZg\LRZĺhkb~!VyE0YgxmD,Et&Lpη*֘4&X_UTPr)W.rgP ,=62W{.=n^˒4R _$[?q:{|7"; 1r~P7XLgbMTr,3 a@'+}ppu0 CHe K` sNB󂴠er $this->lineEnding = $lineEnding; return $this; } /** * Get whether BOM should be used. */ public function getUseBOM(): bool { return $this->useBOM; } /** * Set whether BOM should be used, typically when non-ASCII characters are used. */ public function setUseBOM(bool $useBOM): self { $this->useBOM = $useBOM; return $this; } /** * Get whether a separator line should be included. */ public function getIncludeSeparatorLine(): bool { return $this->includeSeparatorLine; } /** * Set whether a separator line should be included as the first line of the file. */ public function setIncludeSeparatorLine(bool $includeSeparatorLine): self { $this->includeSeparatorLine = $includeSeparatorLine; return $this; } /** * Get whether the file should be saved with full Excel Compatibility. */ public function getExcelCompatibility(): bool { return $this->excelCompatibility; } /** * Set whether the file should be saved with full Excel Compatibility. * * @param bool $excelCompatibility Set the file to be written as a fully Excel compatible csv file * Note that this overrides other settings such as useBOM, enclosure and delimiter */ public function setExcelCompatibility(bool $excelCompatibility): self { $this->excelCompatibility = $excelCompatibility; return $this; } public function getSheetIndex(): int { return $this->sheetIndex; } public function setSheetIndex(int $sheetIndex): self { $this->sheetIndex = $sheetIndex; return $this; } public function getOutputEncoding(): string { return $this->outputEncoding; } public function setOutputEncoding(string $outputEnconding): self { $this->outputEncoding = $outputEnconding; return $this; } /** @var bool */ private $enclosureRequired = true; public function setEnclosureRequired(bool $value): self { $this->enclosureRequired = $value; return $this; } public function getEnclosureRequired(): bool { return $this->enclosureRequired; } /** * Convert boolean to TRUE/FALSE; otherwise return element cast to string. * * @param mixed $element */ private static function elementToString($element): string { if (is_bool($element)) { return $element ? 'TRUE' : 'FALSE'; } return (string) $element; } /** * Write line to CSV file. * * @param resource $fileHandle PHP filehandle * @param array $values Array containing values in a row */ private function writeLine($fileHandle, array $values): void { // No leading delimiter $delimiter = ''; // Build the line $line = ''; foreach ($values as $element) { $element = self::elementToString($element); // Add delimiter $line .= $delimiter; $delimiter = $this->delimiter; // Escape enclosures $enclosure = $this->enclosure; if ($enclosure) { // If enclosure is not required, use enclosure only if // element contains newline, delimiter, or enclosure. if (!$this->enclosureRequired && strpbrk($element, "$delimiter$enclosure\n") === false) { $enclosure = ''; } else { $element = str_replace($enclosure, $enclosure . $enclosure, $element); } } // Add enclosed string $line .= $enclosure . $element . $enclosure; } // Add line ending $line .= $this->lineEnding; // Write to file if ($this->outputEncoding != '') { $line = mb_convert_encoding($line, $this->outputEncoding); } fwrite($fileHandle, /** @scrutinizer ignore-type */ $line); } }